Skip to content

Add Claude Code GitHub Workflow#19

Merged
rajivsinclair merged 2 commits intomainfrom
add-claude-github-actions-1764963104036
Dec 5, 2025
Merged

Add Claude Code GitHub Workflow#19
rajivsinclair merged 2 commits intomainfrom
add-claude-github-actions-1764963104036

Conversation

@rajivsinclair
Copy link
Copy Markdown
Contributor

@rajivsinclair rajivsinclair commented Dec 5, 2025

🤖 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:

  • Bug fixes and improvements
  • Documentation updates
  • Implementing new features
  • Code reviews and suggestions
  • Writing tests
  • And more!

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

  • This workflow won't take effect until this PR is merged
  • @claude mentions won't work until after the merge is complete
  • The workflow runs automatically whenever Claude is mentioned in PR or issue comments
  • Claude gets access to the entire PR or issue context including files, diffs, and previous comments

Security

  • Our Anthropic API key is securely stored as a GitHub Actions secret
  • Only users with write access to the repository can trigger the workflow
  • All Claude runs are stored in the GitHub Actions run history
  • Claude's default tools are limited to reading/writing files and interacting with our repo by creating comments, branches, and commits.
  • We can add more allowed tools by adding them to the workflow file like:
allowed_tools: Bash(npm install),Bash(npm run build),Bash(npm run lint),Bash(npm run test)

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!


Missive conversation: https://mail.missiveapp.com/#inbox/conversations/8740f9b8-162e-4e72-a927-cf4aee4f0161


Important

Add GitHub Actions workflows to integrate Claude Code for automated code reviews and issue handling.

  • Workflows:
    • Adds .github/workflows/claude-code-review.yml to trigger on pull request events (opened, synchronize).
    • Adds .github/workflows/claude.yml to trigger on issue comments, pull request review comments, and issues (opened, assigned).
  • Triggers and Conditions:
    • claude-code-review.yml runs on pull request events and can be filtered by author.
    • claude.yml runs when @claude is mentioned in comments or issues.
  • Permissions:
    • Both workflows use ubuntu-latest and require read permissions for contents, pull-requests, and issues.
    • claude.yml includes actions: read to access CI results.
  • Steps:
    • Both workflows use actions/checkout@v4 to checkout the repository.
    • Use anthropics/claude-code-action@v1 to run Claude with specified OAuth token and optional arguments.

This description was created by Ellipsis for da1562e. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

  • Chores
    • Implemented GitHub Actions workflows that enable automated code reviews on pull requests and developer comments, enhancing development workflow automation and code quality assessment processes.

✏️ Tip: You can customize this high-level summary in your review settings.

Copilot AI review requested due to automatic review settings December 5, 2025 19:41
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 5, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

Two GitHub Actions workflows are added to automate Claude code review. The first runs on pull requests to provide automatic code review feedback. The second triggers on comments and reviews mentioning @claude, with granular permissions and conditional execution.

Changes

Cohort / File(s) Change Summary
GitHub Actions workflows for Claude code review
.github/workflows/claude-code-review.yml, .github/workflows/claude.yml
Added two workflows: claude-code-review.yml automatically triggers on PRs to invoke Claude for quality assessment (bugs, performance, security, coverage); claude.yml triggers on issue/PR comments and reviews mentioning @claude with granular read/write permissions and OAuth token authentication.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Verify GitHub Actions syntax and trigger conditions are correct
  • Confirm OAuth token secret is properly referenced and never logged
  • Validate permission scopes (contents, pull-requests, issues, id-token, actions) align with least-privilege principle
  • Check that commented example configurations don't introduce unintended behavior if uncommented

Poem

🐰 Claude hops in to review your code,
On every PR, a helpful load!
Comments and conversations too,
Quality checks both swift and true!

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-claude-github-actions-1764963104036

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 1b4dc39 and da1562e.

📒 Files selected for processing (2)
  • .github/workflows/claude-code-review.yml (1 hunks)
  • .github/workflows/claude.yml (1 hunks)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@rajivsinclair rajivsinclair merged commit 9ff4fb2 into main Dec 5, 2025
9 of 11 checks passed
Copy link
Copy Markdown

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to da1562e in 1 minute and 4 seconds. Click for details.
  • Reviewed 119 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/claude-code-review.yml:3
  • Draft comment:
    Consider adding 'reopened' to the pull_request event types (e.g., [opened, reopened, synchronize]) to ensure that reviews are triggered when a PR is reopened.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. .github/workflows/claude.yml:15
  • Draft comment:
    The condition for detecting '@claude' mentions is case sensitive. Consider normalizing the case or documenting this requirement if users might use different casings.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. .github/workflows/claude.yml:40
  • Draft comment:
    Verify the format of 'additional_permissions'. If a YAML mapping is intended instead of a multi-line string, consider using proper YAML mapping syntax to avoid potential parsing issues.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_uoEoTj66Qk1WgV0g

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Copy Markdown

Copilot AI left a 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 GitHub Actions workflows to enable Claude Code integration in the repository. Claude Code is an AI coding agent that can be triggered by mentioning @claude in PR or issue comments to help with bug fixes, documentation, code reviews, and more.

Key Changes:

  • Added main Claude Code workflow (.github/workflows/claude.yml) that responds to @claude mentions in comments
  • Added automatic PR review workflow (.github/workflows/claude-code-review.yml) that runs Claude Code review on all new or updated PRs

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
.github/workflows/claude.yml Defines workflow triggered by @claude mentions in issues and PRs, integrating Claude Code action with basic read permissions
.github/workflows/claude-code-review.yml Configures automatic Claude Code reviews on PR open/sync events with custom review prompts and limited bash tool access

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +24
contents: read
pull-requests: read
issues: read
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions are missing pull-requests: write, issues: write, and contents: write which are required for Claude to perform actions like creating comments, branches, and commits as mentioned in the PR description. Without write permissions, Claude will only be able to read but not interact with the repository.

Suggested change
contents: read
pull-requests: read
issues: read
contents: write
pull-requests: write
issues: write

Copilot uses AI. Check for mistakes.
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permissions are missing pull-requests: write which is required for Claude to comment on the PR using gh pr comment as specified in the prompt on line 52. Without write permissions to pull-requests, the workflow will fail when attempting to post the review comment.

Suggested change
pull-requests: read
pull-requests: write

Copilot uses AI. Check for mistakes.
- Security concerns
- Test coverage

Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prompt references "the repository's CLAUDE.md" for guidance on style and conventions, but this file is not included in this PR. If this file doesn't exist in the repository, Claude will not have access to any project-specific guidance, which may lead to inconsistent review feedback.

Suggested change
Use the repository's CLAUDE.md for guidance on style and conventions. Be constructive and helpful in your feedback.
Be constructive and helpful in your feedback. Follow general best practices for code style and conventions.

Copilot uses AI. Check for mistakes.
Comment on lines +16 to +19
(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')))
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow lacks user permission validation. According to the PR description, "Only users with write access to the repository can trigger the workflow," but there's no check to enforce this. Any user who can comment on issues or PRs (including external contributors) can trigger Claude by mentioning @claude. Consider adding a check like github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER' || github.event.comment.author_association == 'COLLABORATOR' to the conditional.

Suggested change
(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.user.author_association == 'MEMBER' ||
github.event.review.user.author_association == 'OWNER' ||
github.event.review.user.author_association == 'COLLABORATOR')
) ||
(
github.event_name == 'issues' &&
(contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')) &&
(github.event.issue.user.author_association == 'MEMBER' ||
github.event.issue.user.author_association == 'OWNER' ||
github.event.issue.user.author_association == 'COLLABORATOR')
)

Copilot uses AI. Check for mistakes.
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using fetch-depth: 1 (shallow clone) may limit Claude's ability to perform thorough code reviews that require git history or comparing against previous commits. For PR reviews, consider using fetch-depth: 0 or at least fetch-depth: 2 to ensure Claude has access to the base branch and can properly review the changes in context.

Suggested change
fetch-depth: 1
fetch-depth: 0

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +22 to +25
permissions:
contents: read
pull-requests: read
issues: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Allow review job to write PR comments

The review workflow config grants only read permissions on issues and pull-requests, yet the prompt at the bottom instructs Claude to post feedback via gh pr comment. The GitHub CLI relies on the job’s GITHUB_TOKEN, and with read-only scopes it returns Resource not accessible by integration, so the review step will fail to publish any comment even if the analysis succeeds. Consider granting write on issues/pull-requests (or supplying a writable token) so the workflow can deliver the review it generates.

Useful? React with 👍 / 👎.

Comment on lines +21 to +24
permissions:
contents: read
pull-requests: read
issues: read
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge General Claude job cannot reply to mentions

The main Claude workflow is triggered by @claude mentions but the job permissions are limited to read-only for issues and pull-requests. Any attempt by the action to acknowledge the request (e.g., post a comment or push a change) using the workflow GITHUB_TOKEN will be rejected for lack of write scope, effectively preventing Claude from responding to the user request. Granting the necessary write permissions or configuring a writable token is needed for the integration to function.

Useful? React with 👍 / 👎.

rajivsinclair added a commit that referenced this pull request Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants