|
12 | 12 |
|
13 | 13 | jobs: |
14 | 14 | claude: |
| 15 | + # Only owners and collaborators can trigger Claude (security: prevents unauthorized use) |
15 | 16 | if: | |
16 | | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
17 | | - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
18 | | - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
19 | | - (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
| 17 | + ( |
| 18 | + (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && |
| 19 | + (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR')) || |
| 20 | + (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && |
| 21 | + (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR')) || |
| 22 | + (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && |
| 23 | + (github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'COLLABORATOR')) || |
| 24 | + (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && |
| 25 | + (github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'COLLABORATOR')) |
| 26 | + ) |
20 | 27 | runs-on: ubuntu-latest |
21 | 28 | permissions: |
22 | | - contents: read |
23 | | - pull-requests: read |
24 | | - issues: read |
| 29 | + contents: write |
| 30 | + pull-requests: write |
| 31 | + issues: write |
25 | 32 | id-token: write |
26 | | - actions: read # Required for Claude to read CI results on PRs |
| 33 | + actions: read |
| 34 | + |
27 | 35 | steps: |
28 | 36 | - name: Checkout repository |
29 | 37 | uses: actions/checkout@v6 |
30 | 38 | with: |
31 | | - fetch-depth: 1 |
| 39 | + fetch-depth: 0 |
32 | 40 |
|
33 | 41 | - name: Run Claude Code |
34 | 42 | id: claude |
35 | 43 | uses: anthropics/claude-code-action@v1 |
36 | 44 | with: |
37 | 45 | claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} |
38 | | - |
39 | | - # This is an optional setting that allows Claude to read CI results on PRs |
40 | | - additional_permissions: | |
41 | | - actions: read |
42 | | -
|
43 | | - # Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it. |
44 | | - # prompt: 'Update the pull request description to include a summary of changes.' |
45 | | - |
46 | | - # Optional: Add claude_args to customize behavior and configuration |
47 | | - # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md |
48 | | - # or https://code.claude.com/docs/en/cli-reference for available options |
49 | | - # claude_args: '--allowed-tools Bash(gh pr:*)' |
50 | | - |
| 46 | + claude_args: | |
| 47 | + --model claude-opus-4-5 |
| 48 | + --allowedTools "Bash(gh:*),Bash(npm:*),Bash(composer:*)" |
| 49 | + --system-prompt "You can create PRs with 'gh pr create', merge with 'gh pr merge', and comment with 'gh issue comment'. Use gh CLI for all GitHub operations." |
0 commit comments