Skip to content

Commit 2ac7853

Browse files
authored
Merge branch 'main' into rebase-registry-dep
2 parents 85d6746 + 1758f35 commit 2ac7853

File tree

1 file changed

+22
-33
lines changed

1 file changed

+22
-33
lines changed

.github/workflows/claude.yml

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,39 @@
11
name: Claude PR Assistant
22

3-
# This workflow allows mentioning @claude in issues and PRs for interactive AI assistance
4-
# Trigger conditions: issue comments, PR review comments, PR reviews, and new issues
53
on:
64
issue_comment:
75
types: [created]
86
pull_request_review_comment:
97
types: [created]
8+
issues:
9+
types: [opened, assigned]
1010
pull_request_review:
1111
types: [submitted]
12-
issues:
13-
types: [opened, edited]
14-
15-
# Permissions required for Claude to read repository content and interact with PRs/issues
16-
permissions:
17-
contents: read # Read repository files and code
18-
pull-requests: read # Read PR information and comments
19-
issues: read # Read issue information and comments
20-
actions: read # Read workflow information
21-
id-token: write # Required for authentication with Anthropic
2212

2313
jobs:
24-
claude-assistant:
25-
# Only run if the comment/issue contains @claude mention
26-
if: contains(github.event.comment.body, '@claude') || contains(github.event.issue.body, '@claude') || contains(github.event.review.body, '@claude')
27-
14+
claude:
15+
name: Claude Code Action
16+
if: |
17+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
19+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
20+
(github.event_name == 'issues' && contains(github.event.issue.body, '@claude'))
2821
runs-on: ubuntu-latest
29-
30-
# Set timeout to prevent runaway workflows
3122
timeout-minutes: 20
32-
23+
permissions:
24+
contents: read
25+
pull-requests: read
26+
issues: read
27+
id-token: write
28+
actions: read # Required for Claude to read CI results on PRs
3329
steps:
34-
# Check out the repository code so Claude can access it
3530
- name: Checkout repository
36-
uses: actions/checkout@v5
37-
38-
# Run Claude Code Action to provide AI assistance
39-
# This action will analyze the context and respond to the @claude mention
40-
- name: Run Claude PR Assistant
41-
uses: anthropics/claude-code-action@v1
31+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
4232
with:
43-
# API key for authenticating with Anthropic's Claude API
44-
# This must be added as a repository secret at:
45-
# Settings → Secrets and variables → Actions → New repository secret
46-
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
33+
fetch-depth: 1
4734

48-
# GitHub token is automatically provided by GitHub Actions
49-
# Used for reading/writing comments and accessing repository data
50-
github-token: ${{ secrets.GITHUB_TOKEN }}
35+
- name: Run Claude Code
36+
id: claude
37+
uses: anthropics/claude-code-action@f4d737af0b61a79741d8246c5207da5887746212 # v1
38+
with:
39+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

0 commit comments

Comments
 (0)