Claude PR Assistant #11799
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
# Based on https://github.com/anthropics/claude-code-action/blob/main/examples/claude.yml | |
name: Claude PR Assistant | |
on: | |
issue_comment: | |
types: [created] | |
pull_request_review_comment: | |
types: [created] | |
issues: | |
types: [opened, assigned] | |
pull_request_review: | |
types: [submitted] | |
jobs: | |
claude-code-action: | |
if: | | |
( | |
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | |
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | |
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | |
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude')) | |
) | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
id-token: write | |
actions: read | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
fetch-depth: 1 | |
persist-credentials: false | |
- name: Setup pnpm | |
uses: ./.github/actions/pnpm-setup | |
- name: Setup Claude settings with lint hook | |
run: bash .github/scripts/setup-claude.sh | |
- name: Run Claude PR Action | |
uses: anthropics/claude-code-action@b60e3f0e60509e51886110d313b82bf9d0df84dd # beta | |
with: | |
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} | |
timeout_minutes: 60 | |
additional_permissions: | | |
actions: read | |
custom_instructions: | | |
You have also been granted tools for editing files and running pnpm commands (fmt, install, lint, test) for testing your changes: pnpm fmt, pnpm install, pnpm lint, pnpm test. | |
MANDATORY PRE-COMMIT HOOK POLICY: | |
- When you see "mcp__github_file_ops__commit_files operation blocked by hook", this means lint/format errors exist | |
- You MUST immediately run "pnpm lint --fix" and "pnpm fmt" to fix all errors | |
- You MUST then manually fix any remaining violations shown in the error output | |
- You MUST continue fixing until "pnpm lint" and "pnpm fmt" both pass completely | |
- Only after ALL checks pass should you retry the commit | |
- NEVER abandon the task when blocked by pre-commit hook - always fix the issues | |
- Your task is NOT complete until the commit succeeds after passing all checks | |
- This is a REQUIREMENT, not a suggestion - commits MUST pass all lint/format checks | |
allowed_tools: | | |
Bash(pnpm fmt:*), | |
Bash(pnpm install), | |
Bash(pnpm lint:*), | |
Bash(pnpm test:*), | |
mcp__github__create_issue, | |
mcp__github__add_issue_comment, | |
mcp__github__create_pull_request |