Repository navigation
Add Claude Code GitHub Workflow - #6
Conversation
There was a problem hiding this comment.
Pull request overview
Adds GitHub Actions workflows to integrate Anthropic Claude Code into the repository, enabling automated agent runs based on PR/issue activity.
Changes:
- Add an “@claude”-triggered workflow for issue/PR comments and reviews.
- Add an automatic PR workflow to run a Claude Code review plugin on PR events.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| .github/workflows/claude.yml | Introduces the comment/review/issue-event triggered Claude Code workflow. |
| .github/workflows/claude-code-review.yml | Introduces an always-on Claude-based PR review workflow triggered on PR lifecycle events. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| issues: | ||
| types: [opened, assigned] | ||
| pull_request_review: | ||
| types: [submitted] | ||
|
|
||
| jobs: | ||
| claude: | ||
| if: | | ||
| (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 workflow can be triggered by any user who can create an issue/comment/review containing “@claude”. Because this job uses a repo secret (CLAUDE_CODE_OAUTH_TOKEN), this effectively allows untrusted users (e.g., first-time issue creators or fork PR authors) to trigger secret-backed runs. Add an explicit trust gate (e.g., restrict to OWNER/MEMBER/COLLABORATOR author_association, or check repo write permissions via the GitHub API) and consider dropping the issues trigger (opened/assigned) entirely to avoid secret exposure from issue titles/bodies.
| issues: | |
| types: [opened, assigned] | |
| pull_request_review: | |
| types: [submitted] | |
| jobs: | |
| claude: | |
| if: | | |
| (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'))) | |
| pull_request_review: | |
| types: [submitted] | |
| jobs: | |
| claude: | |
| if: | | |
| (github.event_name == 'issue_comment' && | |
| contains(github.event.comment.body, '@claude') && | |
| (github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR')) || | |
| (github.event_name == 'pull_request_review_comment' && | |
| contains(github.event.comment.body, '@claude') && | |
| (github.event.comment.author_association == 'OWNER' || | |
| github.event.comment.author_association == 'MEMBER' || | |
| github.event.comment.author_association == 'COLLABORATOR')) || | |
| (github.event_name == 'pull_request_review' && | |
| contains(github.event.review.body, '@claude') && | |
| (github.event.review.author_association == 'OWNER' || | |
| github.event.review.author_association == 'MEMBER' || | |
| github.event.review.author_association == 'COLLABORATOR')) |
| pull-requests: read | ||
| issues: read |
There was a problem hiding this comment.
Job-level permissions are read-only for issues and pull-requests, so this workflow will not be able to post PR/issue comments or apply changes using the default GITHUB_TOKEN. Either update the permissions to the minimum required write scopes for the intended behavior (commenting/committing), or clarify in the workflow/PR description that this is intended to be read-only analysis.
| pull-requests: read | |
| issues: read | |
| pull-requests: write | |
| issues: write |
| on: | ||
| issue_comment: | ||
| types: [created] | ||
| pull_request_review_comment: | ||
| types: [created] | ||
| issues: | ||
| types: [opened, assigned] | ||
| pull_request_review: | ||
| types: [submitted] |
There was a problem hiding this comment.
The PR description says the workflow is triggered by mentioning @claude in a PR/issue comment, but this workflow also triggers on issues events (opened/assigned) if the issue title/body contains @claude. If that’s not intended, remove the issues trigger; if it is intended, please update the PR description/security notes accordingly since it changes who/what can initiate a run.
| on: | ||
| pull_request: | ||
| types: [opened, synchronize, ready_for_review, reopened] | ||
| # Optional: Only run on specific file changes |
There was a problem hiding this comment.
This workflow runs automatically on every PR open/sync/reopen/ready_for_review, which is broader than the PR description (which describes opt-in execution via “@claude” mentions). If this should be opt-in (to control cost/noise), add an if: gate (label/author association), or narrow triggers/paths; otherwise update the PR description to reflect the always-on review behavior.
|
|
||
| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@v1 |
There was a problem hiding this comment.
Both workflows reference anthropics/claude-code-action@v1 (a moving tag). For a third-party action that will run with secrets available, pin to a specific commit SHA (or a version tag plus @<sha> pattern) to reduce supply-chain risk from upstream tag changes.
| uses: anthropics/claude-code-action@v1 | |
| uses: anthropics/claude-code-action@0123456789abcdef0123456789abcdef01234567 |
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@v1 |
There was a problem hiding this comment.
This workflow also uses a moving tag (anthropics/claude-code-action@v1). Since it may run with secrets available, consider pinning to a commit SHA to mitigate supply-chain risk from upstream tag retargeting.
| uses: anthropics/claude-code-action@v1 | |
| uses: anthropics/claude-code-action@<FULL_LENGTH_COMMIT_SHA> # pin to the reviewed v1 revision |
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
…ctions-1776346331261 Add Claude Code GitHub Workflow
🤖 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!