Skip to content

Commit 81daf35

Browse files
Add Claude Code GitHub Workflow (#118)
* "Claude PR Assistant workflow" * fix: harden Claude Code workflow — pin SHA, restrict to trusted actors - Pin anthropics/claude-code-action to immutable commit SHA (094bd24) - Restrict triggers to repo owner, members, and collaborators via author_association checks on each event type - Remove trailing blank line, clean up inline comments - Remove unused optional comments for cleaner config Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * fix: add 30-minute timeout to Claude Code workflow --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 965916c commit 81daf35

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

.github/workflows/claude.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude') &&
17+
(github.event.comment.user.login == github.repository_owner || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) ||
18+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude') &&
19+
(github.event.comment.user.login == github.repository_owner || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'COLLABORATOR')) ||
20+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude') &&
21+
(github.event.review.user.login == github.repository_owner || github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || github.event.review.author_association == 'COLLABORATOR')) ||
22+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
23+
(github.event.issue.user.login == github.repository_owner || github.event.issue.author_association == 'OWNER' || github.event.issue.author_association == 'MEMBER' || github.event.issue.author_association == 'COLLABORATOR'))
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 30
26+
permissions:
27+
contents: read
28+
pull-requests: read
29+
issues: read
30+
id-token: write
31+
actions: read
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
fetch-depth: 1
37+
38+
- name: Run Claude Code
39+
id: claude
40+
uses: anthropics/claude-code-action@094bd24d575e7b30ac1576024817bf1a97c81262 # v1
41+
with:
42+
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
43+
additional_permissions: |
44+
actions: read

0 commit comments

Comments
 (0)