-
Notifications
You must be signed in to change notification settings - Fork 134
Fix claude pr #1243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix claude pr #1243
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -1,7 +1,9 @@ | ||||
| name: Claude Code Review | ||||
|
|
||||
| on: | ||||
| pull_request: | ||||
| # Use pull_request_target so this works for fork PRs and can mint an OIDC token. | ||||
| # IMPORTANT: do NOT checkout or run fork code in this workflow. | ||||
| pull_request_target: | ||||
|
Comment on lines
+4
to
+6
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In anthropics/claude-code-action Issue
Why it happens (per the issue):
Workaround noted in the issue:
If you tell me what outcome you want (e.g., “always comment on the PR even in automation mode” vs “only for Dependabot PRs”), I can suggest a concrete workflow YAML pattern. Sources: [1] 🌐 Web query:
💡 Result:
Sources: custom-automations docs for [1] https://git.homeinfra.org/actions/claude-code-action/src/commit/f4d737af0b61a79741d8246c5207da5887746212/docs/custom-automations.md
There is a confirmed bug in This workflow uses both If reviews are not posted as PR comments, external contributors will never see automated feedback on their PRs. Also applies to: 33-42 🤖 Prompt for AI Agents |
||||
| types: [opened, synchronize, ready_for_review, reopened] | ||||
|
Comment on lines
+4
to
7
|
||||
| # Optional: Only run on specific file changes | ||||
| # paths: | ||||
|
|
@@ -12,11 +14,10 @@ on: | |||
|
|
||||
| jobs: | ||||
| claude-review: | ||||
| # Optional: Filter by PR author | ||||
| # Optional: Filter by PR author / association | ||||
| # if: | | ||||
| # github.event.pull_request.user.login == 'external-contributor' || | ||||
| # github.event.pull_request.user.login == 'new-developer' || | ||||
| # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' | ||||
| # github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' || | ||||
| # github.event.pull_request.author_association == 'CONTRIBUTOR' | ||||
|
Comment on lines
+17
to
+20
|
||||
|
|
||||
| runs-on: ubuntu-latest | ||||
| permissions: | ||||
|
|
@@ -26,10 +27,8 @@ jobs: | |||
| id-token: write | ||||
|
||||
| id-token: write |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -23,28 +23,13 @@ jobs: | |||||||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| issues: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| id-token: write | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| actions: read # Required for Claude to read CI results on PRs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fetch-depth: 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| actions: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Add a checkout step before running Prompt for AI agents
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run Claude Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| id: claude | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: anthropics/claude-code-action@v1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # This is an optional setting that allows Claude to read CI results on PRs | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| additional_permissions: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| actions: read | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
34
to
35
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| additional_permissions: | | |
| actions: read |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's locate and examine the claude.yml file
fd -t f "claude.yml" .github/Repository: MFlowCode/MFC
Length of output: 85
🌐 Web query:
anthropic claude-code-action official documentation examples
💡 Result:
Official documentation (Claude Code GitHub Actions / claude-code-action)
- Anthropic docs: “Claude Code GitHub Actions” (setup, inputs like
prompt/claude_args, and basic workflow example). [1] - Official action repo:
anthropics/claude-code-action(README + detailed guides +examples/). [2]
Official example workflow (from the repo)
A minimal “respond to @claude” workflow is in examples/claude.yml. Here’s the core structure (abridged): [3]
name: Claude Code
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
jobs:
claude:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
# optional: prompt: "..."
# optional: claude_args: "--max-turns 5"Manual setup path (per Anthropic docs): install the Claude GitHub App, add ANTHROPIC_API_KEY as a repo secret, and copy the workflow from examples/claude.yml into .github/workflows/. [1]
🏁 Script executed:
cat -n .github/workflows/claude.ymlRepository: MFlowCode/MFC
Length of output: 1390
Missing actions/checkout step breaks interactive @claude file operations.
The official Anthropic template for claude.yml requires a repository checkout step before the action runs. The official example in the anthropics/claude-code-action repository shows - uses: actions/checkout@v6 as the first step before anthropics/claude-code-action@v1.
This workflow handles interactive mode (triggered by issue_comment, pull_request_review_comment, issues, pull_request_review) where Claude needs to read and modify repository files in response to @claude mentions. Without the checkout step, the action cannot access the repository contents, preventing any file-level operations.
🔧 Proposed fix
steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 1
+
- name: Run Claude Code
id: claude
uses: anthropics/claude-code-action@v1📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| steps: | |
| - name: Run Claude Code | |
| id: claude | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| # This is an optional setting that allows Claude to read CI results on PRs | |
| additional_permissions: | | |
| actions: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Run Claude Code | |
| id: claude | |
| uses: anthropics/claude-code-action@v1 | |
| with: | |
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | |
| additional_permissions: | | |
| actions: read |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/claude.yml around lines 28 - 35, The workflow is missing a
repository checkout so the "Run Claude Code" step using
anthropics/claude-code-action@v1 cannot read or modify files; add an initial
step that runs actions/checkout@v6 (as the first step before the step with id
"claude") so the repository is available for interactive `@claude` file operations
and preserve existing with inputs like claude_code_oauth_token and
additional_permissions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR description/testing sections are still template placeholders (no motivation, testing details, or issue link). Please update the PR description to state what problem is being fixed, why these workflow changes are needed, and how they were validated (e.g., test run links or a screenshot of a successful workflow run).