Skip to content

Add Claude Code GitHub Action#12

Merged
don-petry merged 5 commits intomainfrom
add-claude-code-action
Mar 27, 2026
Merged

Add Claude Code GitHub Action#12
don-petry merged 5 commits intomainfrom
add-claude-code-action

Conversation

@don-petry
Copy link
Copy Markdown
Contributor

@don-petry don-petry commented Mar 27, 2026

Summary

  • Adds Claude Code GitHub Action workflow for automated PR reviews
  • Triggers on PR open/sync and when @claude is mentioned in comments
  • Requires ANTHROPIC_API_KEY secret to be configured in repo settings

Setup Required

  1. Add ANTHROPIC_API_KEY as a repository secret (Settings → Secrets and variables → Actions)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Added an automated AI-assisted code review workflow that runs on pull requests and can be triggered via specific review comments to provide review assistance and annotations.

Copilot AI review requested due to automatic review settings March 27, 2026 03:32
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 27, 2026

Warning

Rate limit exceeded

@don-petry has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 2 minutes and 31 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 2 minutes and 31 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e77cce88-64d2-4824-b53f-6e547248f2d5

📥 Commits

Reviewing files that changed from the base of the PR and between a9fb429 and 838729c.

📒 Files selected for processing (1)
  • .github/workflows/claude.yml
📝 Walkthrough

Walkthrough

Adds a new GitHub Actions workflow .github/workflows/claude.yml that runs the anthropics/claude-code-action@v1 on pull request events and on comment/review-comment events when @claude is mentioned by authorized contributors.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/claude.yml
New workflow "Claude Code" triggers on pull_request (opened, reopened, synchronize), issue_comment, and pull_request_review_comment. Job runs on ubuntu-latest with 60-minute timeout, minimal repo permissions and id-token: write. For comment events, executes only when comment body contains @claude and commenter author_association is OWNER, MEMBER, or COLLABORATOR. Runs anthropics/claude-code-action@v1 using secrets.CLAUDE_CODE_OAUTH_TOKEN as the Anthropic API key.

Sequence Diagram(s)

sequenceDiagram
  participant User as User (commenter / PR author)
  participant GitHub as GitHub Events
  participant Runner as Actions Runner
  participant Claude as Anthropic Claude API

  User->>GitHub: open PR / post comment (may include `@claude`)
  GitHub->>Runner: trigger workflow (conditional evaluated)
  alt condition matched
    Runner->>Runner: set permissions, timeout, env (secrets)
    Runner->>Claude: run anthropics/claude-code-action (with API key)
    Claude-->>Runner: analysis/result
    Runner->>GitHub: post review/comment on PR
  else condition not matched
    GitHub-->>Runner: workflow job skipped
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Claude Code GitHub Action' accurately and concisely describes the main change—adding a new GitHub Actions workflow file for Claude Code integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add-claude-code-action

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

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

Adds a new GitHub Actions workflow to run the Claude Code action for automated pull request reviews, triggered on PR activity and on-demand via @claude comments.

Changes:

  • Introduces a Claude Code workflow triggered on pull_request (opened/reopened/synchronize).
  • Adds an issue_comment trigger to run when a comment contains @claude.
  • Configures the workflow to pass secrets.ANTHROPIC_API_KEY into anthropics/claude-code-action@v1.

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

Comment thread .github/workflows/claude.yml Outdated
Comment thread .github/workflows/claude.yml Outdated
Comment thread .github/workflows/claude.yml
- Restrict issue_comment trigger to PR comments only
- Add author-association check (OWNER/MEMBER/COLLABORATOR)
- Add pull_request_review_comment trigger
- Add timeout-minutes to prevent runaway jobs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/claude.yml (1)

11-22: Consider adding concurrency to avoid duplicate in-flight reviews.

Line 11–Line 22 can queue multiple runs during rapid synchronize events. A concurrency group with cancel-in-progress: true will reduce cost/noise.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/claude.yml around lines 11 - 22, Add a concurrency group
to the claude job to prevent duplicate in-flight runs: under jobs.claude (near
runs-on) add a concurrency block that defines a stable group identifier (e.g.,
using github.workflow and either github.event.pull_request.number or
github.ref/sha) and set cancel-in-progress: true so new runs cancel previous
ones for the same PR/branch.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/claude.yml:
- Line 29: Replace the mutable action ref "anthropics/claude-code-action@v1"
with a pinned commit SHA (e.g., "anthropics/claude-code-action@<commit-sha>") to
prevent automatic updates; locate the uses: anthropics/claude-code-action@v1
line in the workflow and update the tag to the desired immutable commit SHA (or
a full ref like refs/heads/<branch>@<sha>) and commit the change.

---

Nitpick comments:
In @.github/workflows/claude.yml:
- Around line 11-22: Add a concurrency group to the claude job to prevent
duplicate in-flight runs: under jobs.claude (near runs-on) add a concurrency
block that defines a stable group identifier (e.g., using github.workflow and
either github.event.pull_request.number or github.ref/sha) and set
cancel-in-progress: true so new runs cancel previous ones for the same
PR/branch.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ebb4345b-380e-498f-bd97-c3620d0efa38

📥 Commits

Reviewing files that changed from the base of the PR and between 60dae65 and e89b059.

📒 Files selected for processing (1)
  • .github/workflows/claude.yml

Comment thread .github/workflows/claude.yml Outdated
DJ and others added 3 commits March 27, 2026 06:19
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Pin claude-code-action to commit SHA for supply-chain safety
- Add fork PR guard (secrets unavailable for fork PRs)
- Scope pull_request trigger to main branch
- Use >- folded scalar for if expression

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sonarqubecloud
Copy link
Copy Markdown

@don-petry don-petry merged commit 72d45b3 into main Mar 27, 2026
13 checks passed
@don-petry don-petry deleted the add-claude-code-action branch March 27, 2026 13:37
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