-
-
Notifications
You must be signed in to change notification settings - Fork 106
Add Claude Code GitHub Workflow #3979
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds two GitHub Actions workflows to enable Claude Code integration in the repository. The workflows allow users to interact with Claude AI for code reviews and general assistance via @claude mentions in comments.
Key changes:
- Modified
.github/workflows/claude.ymlto update action versions and simplify configuration - Modified
.github/workflows/claude-code-review.ymlto change trigger behavior and add custom prompts for automated PR reviews
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
.github/workflows/claude.yml |
Updated action versions (@v4 checkout, @v1 claude-code-action) and simplified configuration by removing commented-out options |
.github/workflows/claude-code-review.yml |
Changed trigger from pull_request_target to pull_request, updated action versions, replaced direct_prompt with prompt parameter, and added claude_args for tool permissions |
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| uses: actions/checkout@v4 |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actions/checkout action is downgraded to @v4 while other workflows in this repository use @v6. This inconsistency should be avoided. Consider updating to @v6 to match the rest of the repository's workflows (e.g., .github/workflows/codeql.yml, .github/workflows/dotnet.yml, etc.).
| uses: actions/checkout@v4 | |
| uses: actions/checkout@v6 |
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| uses: actions/checkout@v4 |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The actions/checkout action is downgraded to @v4 while other workflows in this repository use @v6. This inconsistency should be avoided. Consider updating to @v6 to match the rest of the repository's workflows (e.g., .github/workflows/codeql.yml, .github/workflows/dotnet.yml, etc.).
| uses: actions/checkout@v4 | |
| uses: actions/checkout@v6 |
|
|
||
| on: | ||
| pull_request_target: | ||
| pull_request: |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the trigger from pull_request_target to pull_request has significant security implications. With pull_request, the workflow runs in the context of the PR branch (including code from potentially untrusted contributors), giving it access to secrets like CLAUDE_CODE_OAUTH_TOKEN. This could allow malicious actors to exfiltrate secrets by modifying the workflow file or repository code in their PR.
pull_request_target is the safer choice for workflows that need secrets and run on PRs from forks, as it executes in the context of the base repository. If you need to use pull_request, ensure you have strict controls on who can open PRs or consider removing access to sensitive secrets.
| pull_request: | |
| pull_request_target: |
| # See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md | ||
| # or https://code.claude.com/docs/en/cli-reference for available options | ||
| claude_args: '--allowed-tools "Bash(gh issue view:*),Bash(gh search:*),Bash(gh issue list:*),Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh pr list:*)"' |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The claude_args grants Claude access to various gh CLI commands including gh pr comment. Combined with the pull_request trigger (line 4), this could allow a malicious PR to execute these commands with the workflow's permissions. Consider either:
- Reverting to
pull_request_targettrigger for better security - Adding strict conditions to limit when this workflow runs (e.g., filtering by author or requiring approval)
- Reducing the allowed tools to read-only operations only
| contents: read | ||
| pull-requests: read | ||
| issues: read | ||
| id-token: write |
Copilot
AI
Dec 4, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The workflow has id-token: write permission but uses pull_request trigger which runs untrusted code. The id-token permission allows generating OIDC tokens that can be used to authenticate with cloud providers. This is a significant security risk if malicious code can access these tokens. Consider:
- Removing
id-token: writeif not strictly necessary - Using
pull_request_targettrigger to run in the trusted context - Adding explicit checks to prevent execution on PRs from untrusted sources
| id-token: write |
🤖 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!