Skip to content

Commit eda0e8e

Browse files
authored
CI: Restrict Claude Code triggers to users with write-access (#349)
1 parent dce48bb commit eda0e8e

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/claude.yaml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
# Auto-review for same-repo PRs
2121
claude-review:
2222
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
23-
runs-on: ubuntu-latest
23+
runs-on: warp-ubuntu-latest-x64-8x
2424
steps:
2525
- uses: actions/checkout@v6
2626
with:
@@ -55,8 +55,9 @@ jobs:
5555
if: |
5656
github.event_name == 'issue_comment' &&
5757
github.event.issue.pull_request &&
58-
contains(github.event.comment.body, '@claude review')
59-
runs-on: ubuntu-latest
58+
contains(github.event.comment.body, '@claude review') &&
59+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
60+
runs-on: warp-ubuntu-latest-x64-8x
6061
steps:
6162
- uses: actions/checkout@v6
6263
with:
@@ -91,13 +92,20 @@ jobs:
9192
- Only use inline comments for problems, not praise.
9293
9394
# General interactive mode - responds to @claude mentions (but NOT review requests on PRs)
95+
# Restricted to users with write access (OWNER, MEMBER, COLLABORATOR)
9496
claude-response:
9597
if: |
96-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude review')) ||
97-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude review')) ||
98-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && !contains(github.event.review.body, '@claude review')) ||
99-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
100-
runs-on: ubuntu-latest
98+
(
99+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association) ||
100+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.review.author_association) ||
101+
contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association)
102+
) && (
103+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) ||
104+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
105+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') && !contains(github.event.comment.body, '@claude review')) ||
106+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') && !contains(github.event.review.body, '@claude review'))
107+
)
108+
runs-on: warp-ubuntu-latest-x64-8x
101109
steps:
102110
- uses: actions/checkout@v6
103111
with:

0 commit comments

Comments
 (0)