Conversation
Reviewer's GuideThis PR introduces two GitHub Actions workflows that integrate the Claude Code AI agent: an automated review workflow for pull requests and an interactive workflow triggered by @claude mentions in issues and comments. Sequence diagram for interactive Claude Code workflow triggered by @claude mentionsequenceDiagram
actor User
participant GitHub
participant "Claude Code Workflow"
participant "Claude Code Action"
participant "Claude AI Service"
User->>GitHub: Create comment with @claude mention
GitHub->>"Claude Code Workflow": Trigger workflow (claude.yml)
"Claude Code Workflow"->>"Claude Code Action": Run action with context
"Claude Code Action"->>"Claude AI Service": Send context and request
"Claude AI Service"-->>"Claude Code Action": Return response
"Claude Code Action"->>GitHub: Post comment/commit/branch as needed
Sequence diagram for automated Claude Code review on PR open/syncsequenceDiagram
participant GitHub
participant "Claude Code Review Workflow"
participant "Claude Code Action"
participant "Claude AI Service"
GitHub->>"Claude Code Review Workflow": PR opened or synchronized
"Claude Code Review Workflow"->>"Claude Code Action": Run action with PR context
"Claude Code Action"->>"Claude AI Service": Send PR context and review prompt
"Claude AI Service"-->>"Claude Code Action": Return review feedback
"Claude Code Action"->>GitHub: Post review comment on PR
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey there - I've reviewed your changes - here's some feedback:
Blocking issues:
- An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. (link)
- An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. (link)
General comments:
- Add write permissions (e.g.,
pull-requests: writeorissues: write) to your workflow so that the action can post review comments back to the PR or issue. - Consider restricting the direct_prompt workflow to only run when a specific label, title flag, or comment trigger is present to avoid running automatic reviews on every PR open/synchronize event.
- You might consolidate the two separate YAML workflows into a single file with conditional steps, which will simplify maintenance and reduce duplication.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add write permissions (e.g., `pull-requests: write` or `issues: write`) to your workflow so that the action can post review comments back to the PR or issue.
- Consider restricting the direct_prompt workflow to only run when a specific label, title flag, or comment trigger is present to avoid running automatic reviews on every PR open/synchronize event.
- You might consolidate the two separate YAML workflows into a single file with conditional steps, which will simplify maintenance and reduce duplication.
## Individual Comments
### Comment 1
<location> `.github/workflows/claude-code-review.yml:36` </location>
<code_context>
uses: anthropics/claude-code-action@beta
</code_context>
<issue_to_address>
**security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha):** An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
*Source: opengrep*
</issue_to_address>
### Comment 2
<location> `.github/workflows/claude.yml:35` </location>
<code_context>
uses: anthropics/claude-code-action@beta
</code_context>
<issue_to_address>
**security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha):** An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
*Source: opengrep*
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| - name: Run Claude Code Review | ||
| id: claude-review | ||
| uses: anthropics/claude-code-action@beta |
There was a problem hiding this comment.
security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
Source: opengrep
|
|
||
| - name: Run Claude Code | ||
| id: claude | ||
| uses: anthropics/claude-code-action@beta |
There was a problem hiding this comment.
security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.
Source: opengrep
…33124 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!
Summary by Sourcery
Integrate Claude Code into the repository via GitHub Actions by adding two workflows: one for automatic PR reviews and another for on-demand AI assistance through @claude mentions.
New Features:
claude-code-reviewworkflow to run automated code reviews with Claude Code on pull request open and synchronize eventsclaudeworkflow to trigger Claude Code actions in response to@claudementions on issues, pull request comments, and review submissionsCI:
anthropics/claude-code-action@betaaction with the CLAUDE_CODE_OAUTH_TOKEN secret for authenticated AI interactions