Skip to content

Conversation

@TabishB
Copy link
Contributor

@TabishB TabishB commented Jan 21, 2026

Summary

Temporary test workflow to validate repository_dispatch works before modifying the release pipeline.

Context

The release pipeline is failing because:

  1. release event is not supported by claude-code-action
  2. workflow_dispatch requires actions:write permission (which the GitHub App doesn't have)
  3. repository_dispatch IS supported and works with existing contents:write permission

Test Plan

  1. Merge this PR
  2. Test via workflow_dispatch (manual trigger in Actions UI)
  3. Test via repository_dispatch:
    gh api repos/Fission-AI/OpenSpec/dispatches --method POST --input - <<< '{"event_type":"test-polish-notes","client_payload":{"tag_name":"v0.23.0"}}'
  4. If both work, implement the real fix in release-prepare.yml
  5. Delete this test workflow

Note

This is a dry-run workflow - it does NOT modify the release. Safe to merge and test.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Enhanced release notes generation process with automated formatting and structured sections for improved clarity and consistency.

✏️ Tip: You can customize this high-level summary in your review settings.

This is a dry-run workflow to test repository_dispatch before modifying
the release pipeline. Will be deleted after validation.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

A new GitHub Actions workflow is added that listens for repository_dispatch (type: test-polish-notes) or workflow_dispatch with tag_name input. The workflow fetches the current release body for a specified tag, passes it through the ClaudeCode action to transform the changelog into polished release notes with structured sections (What's New, New, Improved, Fixed), and displays the generated outputs.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
\.github/workflows/test-polish-dispatch\.yml
New workflow file added (+133 lines) that triggers on repository_dispatch or workflow_dispatch events. Fetches release body via gh release view, processes it through ClaudeCode action to generate release notes and title, and performs dry-run output display. Supports TAG_NAME input from either trigger source with fallback handling.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A workflow takes flight,
Polish dispatch in the night,
Claude shapes the words right, 📝
From changelog to sight,
Release notes burning bright! 🔥

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test: validate repository_dispatch for polish workflow' accurately reflects the main purpose of the changeset, which is to introduce a test workflow that validates the repository_dispatch event for the polish workflow before implementing the real fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vibe-kanban-cloud
Copy link

Review Complete

Your review story is ready!

View Story

Comment !reviewfast on this PR to re-generate the story.

@greptile-apps
Copy link

greptile-apps bot commented Jan 21, 2026

Greptile Summary

This PR adds a temporary test workflow to validate that repository_dispatch works correctly before modifying the production release pipeline. The test workflow mirrors the production polish-release-notes.yml workflow but runs in dry-run mode without actually updating releases.

  • Supports both workflow_dispatch (manual UI trigger) and repository_dispatch (API trigger via gh api)
  • Intelligently handles tag input from either inputs.tag_name or client_payload.tag_name
  • Includes debug output to verify the correct event type and tag resolution
  • Safe to merge as it only displays transformed content without modifying releases
  • Should be deleted after validation is complete (as noted in comments)

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The workflow is explicitly designed as a dry-run test with no side effects. It only displays output without modifying any releases, making it completely safe for validation purposes. The logic correctly handles both dispatch types, includes appropriate repository checks, and clearly documents its temporary nature.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/test-polish-dispatch.yml Added temporary test workflow to validate repository_dispatch trigger before modifying production release pipeline. Includes dry-run safeguards.

Sequence Diagram

sequenceDiagram
    participant Dev as Developer/Release System
    participant GH as GitHub Actions
    participant Dispatch as Test Workflow
    participant Claude as Claude Code Action
    participant Release as GitHub Release

    alt Manual Test (workflow_dispatch)
        Dev->>GH: Trigger workflow manually
        GH->>Dispatch: Pass tag via inputs.tag_name
    else API Test (repository_dispatch)
        Dev->>GH: POST /repos/.../dispatches
        GH->>Dispatch: Pass tag via client_payload.tag_name
    end

    Dispatch->>Dispatch: Resolve TAG_NAME from inputs or payload
    Dispatch->>Dispatch: Debug context (event name, tag)
    Dispatch->>Release: Fetch release notes via gh CLI
    Release-->>Dispatch: Return current-notes.md
    Dispatch->>Dispatch: Preview first 20 lines
    Dispatch->>Claude: Transform notes with prompt
    Claude-->>Dispatch: Generate release-title.txt & polished-notes.md
    Dispatch->>Dispatch: Display results (DRY RUN - no update)
    Dispatch->>Dev: Show transformed content for validation
Loading

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.github/workflows/test-polish-dispatch.yml:
- Around line 20-21: The workflow currently sets GitHub Actions permissions to
"contents: write"; change this to "contents: read" to follow least-privilege
principles since the job only reads release data and writes local files, and
verify any action that might require write (e.g., the Claude-related action)
actually doesn't need push-level content permission; update the permissions
block to use "contents: read" and if you discover an action truly requires
write, scope that permission as narrowly as possible or add it only to the
specific job that needs it.
- Around line 16-18: The workflow currently sets TAG_NAME from client_payload or
inputs but lacks a guard when it's empty, causing `gh release view` to fail with
a confusing error; add an explicit guard step that checks the TAG_NAME
environment variable (TAG_NAME) before any `gh release view` or release-related
steps and fails fast with a clear message if TAG_NAME is undefined or empty so
CI prints a helpful error and stops early.
- Around line 46-52: The GitHub Actions step "Transform release notes with
Claude" currently uses the tag anthropics/claude-code-action@v1 while passing a
sensitive claude_code_oauth_token; replace the tag with the full commit SHA for
anthropics/claude-code-action (e.g.,
anthropics/claude-code-action@<full-commit-sha>) to pin the third‑party action,
keeping the step id "claude" and the same inputs (claude_code_oauth_token,
github_token, claude_args) unchanged.

Comment on lines +16 to +18
env:
# repository_dispatch passes tag via client_payload, workflow_dispatch via inputs
TAG_NAME: ${{ github.event.client_payload.tag_name || inputs.tag_name }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a guard when TAG_NAME is missing.
If neither payload nor input is set, gh release view fails with a confusing error. A fast, explicit check will make runs clearer.

🔧 Suggested guard step
+      - name: Validate tag input
+        run: |
+          if [ -z "${{ env.TAG_NAME }}" ]; then
+            echo "TAG_NAME is required via workflow_dispatch input or repository_dispatch payload"
+            exit 1
+          fi
🤖 Prompt for AI Agents
In @.github/workflows/test-polish-dispatch.yml around lines 16 - 18, The
workflow currently sets TAG_NAME from client_payload or inputs but lacks a guard
when it's empty, causing `gh release view` to fail with a confusing error; add
an explicit guard step that checks the TAG_NAME environment variable (TAG_NAME)
before any `gh release view` or release-related steps and fails fast with a
clear message if TAG_NAME is undefined or empty so CI prints a helpful error and
stops early.

Comment on lines +20 to +21
permissions:
contents: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Reduce token scope to least privilege.
This dry-run only reads release data and writes local files; contents: read should be sufficient unless the Claude action actually needs write.

🔒 Suggested permission tightening
 permissions:
-  contents: write
+  contents: read
🤖 Prompt for AI Agents
In @.github/workflows/test-polish-dispatch.yml around lines 20 - 21, The
workflow currently sets GitHub Actions permissions to "contents: write"; change
this to "contents: read" to follow least-privilege principles since the job only
reads release data and writes local files, and verify any action that might
require write (e.g., the Claude-related action) actually doesn't need push-level
content permission; update the permissions block to use "contents: read" and if
you discover an action truly requires write, scope that permission as narrowly
as possible or add it only to the specific job that needs it.

Comment on lines +46 to +52
- name: Transform release notes with Claude
uses: anthropics/claude-code-action@v1
id: claude
with:
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
claude_args: "--allowedTools Write,Read"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

anthropics/claude-code-action GitHub action

💡 Result:

anthropics/claude-code-action is Anthropic’s official GitHub Action for running Claude Code inside GitHub workflows. It can answer code questions, review and modify PRs, create PRs from prompts, and integrate with Anthropic API or cloud providers (Bedrock, Vertex AI, Foundry). Key points and quick setup:

  • Repo & license: anthropics/claude-code-action (MIT). [1]
  • Features: automatic mode detection, PR/issue integration, code implementation/review, structured JSON outputs, runs on your runner. [1]
  • Docs & quickstart: Anthropic docs explain installing the Claude GitHub app, adding ANTHROPIC_API_KEY secret, or using the CLI /install-github-app. Manual setup: install https://github.com/apps/claude, add secret, copy examples/claude.yml to .github/workflows. [2]
  • Marketplace listing and example usage (workflow snippet, outputs, and the dangerous skip-permissions flag info). [3]

If you want, I can:

  • show an example workflow configured for Anthropic API or for AWS Bedrock/Google Vertex,
  • or walk through installing the GitHub app and adding secrets step-by-step. Which do you want?

🌐 Web query:

GitHub Actions security best practices pinning commit SHA vs version tag

💡 Result:

Short answer

  • Pin to a full commit SHA for maximum security (immutable, prevents tag/branch tampering). [1][2]
  • Tags (version tags) are more convenient but mutable unless the project offers immutable releases — only use tags for actions you fully trust or when the author provides immutable/attested releases. [1][2]
  • Automate safe updates (Dependabot/Renovate or tooling that updates SHAs and opens PRs) and enforce SHA pinning/org policy where practical. [1][2][3]

Why (brief)

  • Commit SHA = exact Git object; cannot be changed without changing the SHA → strong protection against covert updates. [1]
  • Tags/branches (v3, v3.1, main) can be moved or re-pointed if a repo is compromised, so workflows using them can pick up malicious changes. [1][2]
  • Organizations can enforce SHA pinning via allowed-actions policies and block specific actions/versions. [2]

Practical recommendations

  • Use commit SHAs in workflows: uses: owner/repo/path@, and add a comment with the human-friendly tag/version. [1][8]
  • Run automation to keep SHAs up to date (Dependabot for Actions, Renovate, or pinning tools) so updates are reviewed before merging. [1][3]
  • Avoid floating refs: no @main, @latest, or bare major tags unless you accept the risk. [1][5]
  • Restrict/allowlist verified creators or specific repos; use the allowed-actions policy to block unapproved actions. [1][2]
  • Audit action source code and limit workflow permissions & secrets to reduce blast radius even if an action is compromised. [1]

References

  • GitHub Security hardening for Actions (pin to full-length commit SHA; tag guidance). [1]
  • GitHub Changelog: allowed actions policy, blocklist and SHA pin enforcement features. [2]
  • Example tooling & automation to enforce/update pins (Dependabot/third-party pinning actions). [3]

🏁 Script executed:

# Check if there are other actions used in the repository and their pinning practices
cd .github/workflows
find . -name "*.yml" -o -name "*.yaml" | head -10

Repository: Fission-AI/OpenSpec

Length of output: 147


🏁 Script executed:

# Check action pinning patterns in other workflow files
cd .github/workflows
for file in *.yml; do
  echo "=== $file ==="
  grep -E "uses:" "$file" | head -5
done

Repository: Fission-AI/OpenSpec

Length of output: 697


Pin the third‑party action to a commit SHA.

This step uses a sensitive OAuth token; pinning to a commit SHA prevents tag tampering and supply-chain surprises. GitHub security guidance recommends committing full commit SHAs rather than version tags for third-party actions, particularly when handling credentials.

🔒 Suggested pinning
-      - name: Transform release notes with Claude
-        uses: anthropics/claude-code-action@v1
+      - name: Transform release notes with Claude
+        uses: anthropics/claude-code-action@<pinned-commit-sha>
🤖 Prompt for AI Agents
In @.github/workflows/test-polish-dispatch.yml around lines 46 - 52, The GitHub
Actions step "Transform release notes with Claude" currently uses the tag
anthropics/claude-code-action@v1 while passing a sensitive
claude_code_oauth_token; replace the tag with the full commit SHA for
anthropics/claude-code-action (e.g.,
anthropics/claude-code-action@<full-commit-sha>) to pin the third‑party action,
keeping the step id "claude" and the same inputs (claude_code_oauth_token,
github_token, claude_args) unchanged.

@TabishB TabishB enabled auto-merge (squash) January 21, 2026 02:48
@TabishB TabishB disabled auto-merge January 21, 2026 03:01
@TabishB TabishB merged commit 2beb8e7 into main Jan 21, 2026
10 checks passed
@TabishB TabishB deleted the test/polish-dispatch branch January 21, 2026 03:01
TabishB added a commit that referenced this pull request Jan 21, 2026
The GitHub App token doesn't have actions:write permission, which is
required for workflow_dispatch. Switch to repository_dispatch which
works with existing contents:write permission.

Changes:
- release-prepare.yml: Use gh api to trigger repository_dispatch
- polish-release-notes.yml: Add repository_dispatch trigger type
- Delete test workflow (validation complete)

Tested via PR #542 - both workflow_dispatch and repository_dispatch
triggers work correctly with claude-code-action.
TabishB added a commit that referenced this pull request Jan 21, 2026
The GitHub App token doesn't have actions:write permission, which is
required for workflow_dispatch. Switch to repository_dispatch which
works with existing contents:write permission.

Changes:
- release-prepare.yml: Use gh api to trigger repository_dispatch
- polish-release-notes.yml: Add repository_dispatch trigger type
- Delete test workflow (validation complete)

Tested via PR #542 - both workflow_dispatch and repository_dispatch
triggers work correctly with claude-code-action.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants