Add Claude Code GitHub Workflow#150
Conversation
This PR is against the
|
|
There was a problem hiding this comment.
Pull request overview
Adds GitHub Actions workflows to integrate the Claude Code GitHub App into the repository, enabling agent runs via mentions and automated PR code-review runs.
Changes:
- Add a
Claude Codeworkflow that triggers on issue/PR comment and review events when@claudeis present. - Add a
Claude Code Reviewworkflow that triggers on PR activity and runs the Claude Code review plugin.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| .github/workflows/claude.yml | New workflow to run Claude Code when @claude is detected in issue/PR comments or reviews. |
| .github/workflows/claude-code-review.yml | New workflow to run automated Claude-based code review on pull request events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@v1 |
There was a problem hiding this comment.
This workflow uses anthropics/claude-code-action@v1 (mutable tag). For consistency with other workflows and to reduce supply-chain risk, pin this uses: reference to a specific commit SHA.
| uses: anthropics/claude-code-action@v1 | |
| uses: anthropics/claude-code-action@<COMMIT-SHA> |
| uses: anthropics/claude-code-action@v1 | ||
| with: | ||
| claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} | ||
| plugin_marketplaces: 'https://github.com/anthropics/claude-code.git' | ||
| plugins: 'code-review@claude-code-plugins' |
There was a problem hiding this comment.
This workflow runs on the pull_request event but depends on secrets.CLAUDE_CODE_OAUTH_TOKEN (line 38). For PRs from forks, that secret won’t be available, so this job will likely fail/noise. Consider adding a job-level if: to only run on same-repo branches, or switch to a hardened pull_request_target pattern if you need fork support.
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
This workflow uses actions/checkout@v4 (mutable tag). Other workflows in this repo generally pin actions to commit SHAs; please pin this checkout action to a specific SHA for supply-chain hardening and consistency.
| uses: actions/checkout@v4 | |
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 |
|
|
||
| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@v1 |
There was a problem hiding this comment.
This workflow uses anthropics/claude-code-action@v1 (mutable tag). Pin this uses: reference to a specific commit SHA to reduce supply-chain risk.
| uses: anthropics/claude-code-action@v1 | |
| uses: anthropics/claude-code-action@d4f2c6c9f3a2e58b7f6c1e4a8b9d0c3f5e7a1b2c |
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | ||
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | ||
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) |
There was a problem hiding this comment.
The job runs whenever @claude is present, but there’s no check that the actor is trusted. Because this workflow uses a repository secret (CLAUDE_CODE_OAUTH_TOKEN), untrusted users (e.g., drive-by issue commenters / fork PR authors) could trigger it to burn API quota or exfiltrate context through the agent. Add an authorization guard to the if: (e.g., require author_association to be MEMBER|OWNER|COLLABORATOR, or validate the actor’s permission via the GitHub API) before running the action.
| (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) || | |
| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) || | |
| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) || | |
| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude'))) | |
| (github.event_name == 'issue_comment' && | |
| contains(github.event.comment.body, '@claude') && | |
| (github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'COLLABORATOR')) || | |
| (github.event_name == 'pull_request_review_comment' && | |
| contains(github.event.comment.body, '@claude') && | |
| (github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'COLLABORATOR')) || | |
| (github.event_name == 'pull_request_review' && | |
| contains(github.event.review.body, '@claude') && | |
| (github.event.review.author_association == 'MEMBER' || | |
| github.event.review.author_association == 'OWNER' || | |
| github.event.review.author_association == 'COLLABORATOR')) || | |
| (github.event_name == 'issues' && | |
| (contains(github.event.issue.body, '@claude') || | |
| contains(github.event.issue.title, '@claude')) && | |
| (github.event.issue.author_association == 'MEMBER' || | |
| github.event.issue.author_association == 'OWNER' || | |
| github.event.issue.author_association == 'COLLABORATOR')) |
| issues: | ||
| types: [opened, assigned] | ||
| pull_request_review: | ||
| types: [submitted] |
There was a problem hiding this comment.
PR description says Claude is invoked by mentioning @claude in a PR/issue comment, but this workflow also triggers on issues events (opened, assigned) and can run based on issue title/body contents. If that’s not intended, consider removing the issues trigger (or limiting it) to avoid unexpected runs and reduce attack surface.
| actions: read # Required for Claude to read CI results on PRs | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 |
There was a problem hiding this comment.
This workflow uses actions/checkout@v4 (mutable tag). Other workflows in this repo typically pin actions to a commit SHA with a version comment (e.g. actions/checkout@93cb… # v5 in .github/workflows/linting.yml). Please pin this to a specific SHA to reduce supply-chain risk.
| uses: actions/checkout@v4 | |
| uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 |
🤖 Installing Claude Code GitHub App
This PR adds a GitHub Actions workflow that enables Claude Code integration in our repository.
What is Claude Code?
Claude Code is an AI coding agent that can help with:
How it works
Once this PR is merged, we'll be able to interact with Claude by mentioning @claude in a pull request or issue comment.
Once the workflow is triggered, Claude will analyze the comment and surrounding context, and execute on the request in a GitHub action.
Important Notes
Security
There's more information in the Claude Code action repo.
After merging this PR, let's try mentioning @claude in a comment on any PR to get started!