|
14 | 14 |
|
15 | 15 | jobs: |
16 | 16 | # Automatic PR review (can fix linting issues and push) |
| 17 | + # Blocked for fork PRs to prevent malicious code execution |
17 | 18 | pr-review: |
18 | | - if: github.event_name == 'pull_request' && github.actor != 'claude[bot]' |
| 19 | + if: | |
| 20 | + github.event_name == 'pull_request' && |
| 21 | + github.actor != 'claude[bot]' && |
| 22 | + github.event.pull_request.head.repo.full_name == github.repository |
19 | 23 | runs-on: ubuntu-latest |
20 | 24 | permissions: |
21 | 25 | contents: write |
|
44 | 48 | with: |
45 | 49 | use_foundry: "true" |
46 | 50 | use_sticky_comment: true |
| 51 | + allowed_bots: "claude[bot]" |
47 | 52 | prompt: | |
48 | 53 | REPO: ${{ github.repository }} |
49 | 54 | PR NUMBER: ${{ github.event.pull_request.number }} |
@@ -124,13 +129,31 @@ jobs: |
124 | 129 | ANTHROPIC_FOUNDRY_API_KEY: ${{ secrets.AZURE_ANTHROPIC_API_KEY }} |
125 | 130 | ANTHROPIC_FOUNDRY_BASE_URL: ${{ secrets.AZURE_ANTHROPIC_ENDPOINT }} |
126 | 131 |
|
127 | | - # @claude mentions (can edit and push) |
| 132 | + # @claude mentions (can edit and push) - restricted to maintainers only |
128 | 133 | claude-mention: |
129 | 134 | if: | |
130 | | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || |
131 | | - (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || |
132 | | - (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || |
133 | | - (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
| 135 | + ( |
| 136 | + github.event_name == 'issue_comment' && |
| 137 | + contains(github.event.comment.body, '@claude') && |
| 138 | + (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR') |
| 139 | + ) || |
| 140 | + ( |
| 141 | + github.event_name == 'pull_request_review_comment' && |
| 142 | + contains(github.event.comment.body, '@claude') && |
| 143 | + (github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR') && |
| 144 | + github.event.pull_request.head.repo.full_name == github.repository |
| 145 | + ) || |
| 146 | + ( |
| 147 | + github.event_name == 'pull_request_review' && |
| 148 | + contains(github.event.review.body, '@claude') && |
| 149 | + (github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'COLLABORATOR') && |
| 150 | + github.event.pull_request.head.repo.full_name == github.repository |
| 151 | + ) || |
| 152 | + ( |
| 153 | + github.event_name == 'issues' && |
| 154 | + (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) && |
| 155 | + (github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER' || github.event.issue.author_association == 'COLLABORATOR') |
| 156 | + ) |
134 | 157 | runs-on: ubuntu-latest |
135 | 158 | permissions: |
136 | 159 | contents: write |
@@ -171,7 +194,7 @@ jobs: |
171 | 194 | uses: anthropics/claude-code-action@v1 |
172 | 195 | with: |
173 | 196 | use_foundry: "true" |
174 | | - claude_args: '--allowedTools "Read,Edit,Write,Glob,Grep,Bash(git status*),Bash(git diff*),Bash(git add *),Bash(git commit *),Bash(git push*),Bash(git log*),Bash(uv run prek *),Bash(prek *),Bash(uv run ruff *),Bash(uv run pytest *),Bash(uv run mypy *),Bash(uv run coverage *),Bash(gh pr comment*),Bash(gh pr view*),Bash(gh pr diff*)"' |
| 197 | + claude_args: '--allowedTools "Read,Edit,Write,Glob,Grep,Bash(git status*),Bash(git diff*),Bash(git add *),Bash(git commit *),Bash(git push*),Bash(git log*),Bash(git merge*),Bash(git fetch*),Bash(git checkout*),Bash(git branch*),Bash(uv run prek *),Bash(prek *),Bash(uv run ruff *),Bash(uv run pytest *),Bash(uv run mypy *),Bash(uv run coverage *),Bash(gh pr comment*),Bash(gh pr view*),Bash(gh pr diff*),Bash(gh pr merge*),Bash(gh pr close*)"' |
175 | 198 | additional_permissions: | |
176 | 199 | actions: read |
177 | 200 | env: |
|
0 commit comments