fix model name delivery and log more info #1425
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Claude Code | |
| on: | |
| issue_comment: | |
| types: [created] | |
| pull_request_review_comment: | |
| types: [created, opened, assigned] | |
| pull_request_review: | |
| types: [submitted] | |
| jobs: | |
| claude-review: | |
| if: contains(github.event.comment.body, '@claude review') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| id-token: write | |
| actions: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Run Claude Code Review | |
| id: claude-review | |
| uses: anthropics/claude-code-action@v1 | |
| env: | |
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | |
| CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: 1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| show_full_output: true | |
| prompt: | | |
| # PR Review | |
| **REPO:** `${{ github.repository }}` | |
| **PR NUMBER:** `${{ github.event.pull_request.number || github.event.issue.number }}` | |
| ## Accessing PR Content | |
| Use the following commands to access the PR content: | |
| - `gh pr view <PR NUMBER> --comments` | |
| - `gh pr diff <PR NUMBER> --patch` | |
| You can use multiple subagents to parallelize tasks. Each subagent should be told the PR title and description. | |
| ## PR Review Guide | |
| You are in repository without that patch applied. **Do not apply it.** | |
| Assume the patch will be built and tested by other GitHub Actions workflows. | |
| ### Focus Areas | |
| - Code quality, style, and best practices | |
| - Potential bugs, issues, incorrect logic | |
| - Security implications | |
| - `.claude/CLAUDE.md` compliance | |
| ### Review Process | |
| 1. For every issue, rate how significant it is. Make sure you are confident in your diagnosis. | |
| 2. Provide detailed feedback as PR comments, using inline comments for specific issues. | |
| 3. Use `gh pr comment ${{ github.event.pull_request.number || github.event.issue.number }} --body "..."` for top-level summary. Keep it short. | |
| 4. Use `mcp__github_inline_comment__create_inline_comment` to highlight specific code issues. | |
| 5. Prefix all your GitHub comments with "Claude: ". | |
| 6. Use `gh pr view <PR NUMBER> --comments` output to make sure you don't comment about the same issue twice. | |
| ### Code Linking Format | |
| When linking to code in inline comments, follow this format precisely (otherwise the Markdown preview won't render correctly): | |
| First resolve the head SHA dynamically: | |
| ``` | |
| gh pr view <PR NUMBER> --json headRefOid -q .headRefOid | |
| ``` | |
| Then use it in links: | |
| ``` | |
| https://github.com/${{ github.repository }}/blob/<HEAD_SHA>/README.md#L10-L15 | |
| ``` | |
| claude_args: | | |
| --max-turns 30 | |
| --model claude-opus-4-6 | |
| --allowedTools " | |
| Read,Write,Edit,MultiEdit,LS,Grep,Glob, | |
| Bash(cat:*),Bash(test:*),Bash(printf:*),Bash(jq:*),Bash(head:*),Bash(git:*),Bash(gh:*), | |
| mcp__github_inline_comment__create_inline_comment, | |
| " | |
| settings: | | |
| { | |
| "env": { | |
| "DEBUG": "true" | |
| } | |
| } | |
| allowed_non_write_users: "*" | |
| track_progress: false | |
| claude-comment: | |
| if: | | |
| contains(github.event.comment.body, '@claude') && | |
| !contains(github.event.comment.body, '@claude review') | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| issues: write | |
| id-token: write | |
| actions: read | |
| steps: | |
| - name: Get issue/PR info and select PAT | |
| id: pr | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const issue = context.payload.issue; | |
| const isPR = issue && issue.pull_request; | |
| let author, headRef, headRepo; | |
| if (isPR) { | |
| // This is a PR comment, fetch PR details | |
| const pr = await github.rest.pulls.get({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: context.issue.number, | |
| }); | |
| author = pr.data.user.login; | |
| headRef = pr.data.head.ref; | |
| headRepo = pr.data.head.repo.full_name; | |
| } else { | |
| // This is a pure issue comment | |
| author = issue.user.login; | |
| } | |
| const pats = JSON.parse(process.env.CONTRIBUTOR_PATS); | |
| const token = pats[author]; | |
| if (!token) { | |
| core.setFailed(`No PAT found for user: ${author}`); | |
| return; | |
| } | |
| core.setSecret(token); | |
| core.setOutput('token', token); | |
| if (isPR) { | |
| core.setOutput('head_ref', headRef); | |
| core.setOutput('head_repo', headRepo); | |
| } | |
| env: | |
| CONTRIBUTOR_PATS: ${{ secrets.CONTRIBUTOR_PATS }} | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - name: Run Claude Code Review | |
| id: claude-review | |
| uses: anthropics/claude-code-action@v1 | |
| env: | |
| ANTHROPIC_BASE_URL: ${{ secrets.ANTHROPIC_BASE_URL }} | |
| CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS: 1 | |
| with: | |
| anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
| show_full_output: true | |
| prompt: | | |
| REPO: ${{ github.repository }} | |
| PR or issue NUMBER: ${{ github.event.pull_request.number || github.event.issue.number }} | |
| COMMENT_USER: ${{ github.event.comment.user.login }} | |
| COMMENT_CONTENT: ${{ github.event.comment.body }} | |
| Please answer the user's question. If you need to get the PR content, you can | |
| use `gh pr view <PR NUMBER> --comments` and `gh pr diff <PR NUMBER> --patch` to access the PR content. | |
| You can use multiple subagents to parallelize tasks. Each subagent should be told the PR title and | |
| description. | |
| If a user requests PR modifications, push the changes to the forked repository for fork PRs: | |
| ```console | |
| git push https://x-access-token:${{ steps.pr.outputs.token }}@github.com/<fork-repo-path>.git HEAD:<fork-branch> | |
| ``` | |
| otherwise, push directly to the origin repository. | |
| If you update the branch, you **MUST** provide the URL of the new commit. | |
| ## Summary Requirement | |
| After completing all actions, you **MUST** post a summary comment to the issue or PR using `gh`. This | |
| lets the user know exactly what was done. Use the appropriate command: | |
| - For PRs: `gh pr comment <NUMBER> --body "<summary>"` | |
| - For issues: `gh issue comment <NUMBER> --body "<summary>"` | |
| The summary must include: | |
| 1. What the user requested (one-line recap). | |
| 2. What actions were taken (e.g., files modified, commits pushed, reviews posted). | |
| 3. Links to any new commits or relevant references. | |
| 4. If no action was taken (e.g., only answered a question), summarize the answer briefly. | |
| Prefix the summary comment with "**Claude:**" so it is clearly identifiable. | |
| claude_args: | | |
| --max-turns 30 | |
| --model claude-opus-4-6 | |
| --allowedTools " | |
| Read,Write,Edit,MultiEdit,LS,Grep,Glob, | |
| Bash(cat:*),Bash(test:*),Bash(printf:*),Bash(jq:*),Bash(head:*),Bash(git:*),Bash(gh:*), | |
| mcp__github_inline_comment__create_inline_comment, | |
| " | |
| settings: | | |
| { | |
| "env": { | |
| "DEBUG": "true" | |
| } | |
| } | |
| allowed_non_write_users: "*" | |
| track_progress: false | |