Skip to content

Add Claude Code GitHub Workflow - #167

Merged
keito4 merged 3 commits into
mainfrom
add-claude-github-actions-1766472978967
Dec 23, 2025
Merged

Add Claude Code GitHub Workflow#167
keito4 merged 3 commits into
mainfrom
add-claude-github-actions-1766472978967

Conversation

@keito4

@keito4 keito4 commented Dec 23, 2025

Copy link
Copy Markdown
Owner

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

Summary by CodeRabbit

  • Chores
    • Added an automated code review workflow that runs on pull requests to assess code quality, potential bugs, performance, security, and test coverage.
    • Updated the existing code-review workflow with refined per-job permissions, a new authentication token approach, and an updated review action version for more reliable reporting.

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

@coderabbitai

coderabbitai Bot commented Dec 23, 2025

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

Adds a new GitHub Actions workflow for automated Claude code reviews and updates an existing Claude workflow to use anthropics/claude-code-action@v1, consolidate authentication to a single OAuth token input, and move permissions from global to per-job scope.

Changes

Cohort / File(s) Summary
New Claude Code Review Workflow
​.github/workflows/claude-code-review.yml
New workflow triggered on PR opened/synchronized that runs anthropics/claude-code-action@v1, supplies PR/repo context and a multi-line prompt to Claude, and configures claude_args to enable bash-style gh tool commands with token-based auth via CLAUDE_CODE_OAUTH_TOKEN.
Updated Claude Workflow Configuration
​.github/workflows/claude.yml
Replaced global permissions with per-job permissions (contents/pull-requests/issues read/write, id-token write, actions read), upgraded action from anthropics/claude-code-action@beta to @v1, consolidated inputs to claude_code_oauth_token, removed allowed_tools, added step id and additional_permissions block.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant PR as "GitHub PR (event)"
  participant Runner as "GitHub Actions Runner"
  participant Repo as "Repository (checkout)"
  participant Claude as "anthropics/claude-code-action@v1"
  participant GH_API as "GitHub API (gh CLI)"

  Note over PR,Runner: Trigger on PR opened / synchronized
  PR->>Runner: webhook triggers workflow
  Runner->>Repo: checkout code (actions/checkout)
  Runner->>Claude: run Claude action with PR metadata + prompt\n(claims token via claude_code_oauth_token)
  Claude->>Claude: analyze diff, repo files, tests
  Claude->>GH_API: post review comment using gh commands (via enabled claude_args)
  GH_API->>PR: comment on PR with findings
  Note over GH_API,PR: workflow ends
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ 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 clearly and concisely summarizes the main change: adding a GitHub Actions workflow for Claude Code integration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68c4533 and f57b7b4.

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

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.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/claude.yml (1)

1-1: Fix Prettier formatting issues.

The CI pipeline has detected formatting issues in this file. Run prettier --write .github/workflows/claude.yml to fix them before merging.

📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 871baa3 and 68c4533.

📒 Files selected for processing (2)
  • .github/workflows/claude-code-review.yml
  • .github/workflows/claude.yml
🧰 Additional context used
📓 Path-based instructions (1)
.github/workflows/claude.yml

📄 CodeRabbit inference engine (CLAUDE.md)

Trigger automatic AI assistance on @claude mentions in issues, PRs, and comments using .github/workflows/claude.yml

Files:

  • .github/workflows/claude.yml
🧠 Learnings (5)
📓 Common learnings
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/claude.yml : Trigger automatic AI assistance on claude mentions in issues, PRs, and comments using .github/workflows/claude.yml
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/update-libraries.yml : Execute npm run update:libs on schedule and open pull requests when dependencies or Codex/Claude tooling changes in .github/workflows/update-libraries.yml
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T08:39:14.049Z
Learning: Follow development quality standards defined in `CLAUDE.md` when using Claude Code for development assistance
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/ci.yml : Validate code quality in CI pipeline (.github/workflows/ci.yml) with linting, formatting, testing, and building
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/claude.yml : Trigger automatic AI assistance on claude mentions in issues, PRs, and comments using .github/workflows/claude.yml

Applied to files:

  • .github/workflows/claude.yml
  • .github/workflows/claude-code-review.yml
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/update-libraries.yml : Execute npm run update:libs on schedule and open pull requests when dependencies or Codex/Claude tooling changes in .github/workflows/update-libraries.yml

Applied to files:

  • .github/workflows/claude.yml
  • .github/workflows/claude-code-review.yml
📚 Learning: 2025-12-09T08:39:14.049Z
Learnt from: CR
Repo: keito4/config PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-09T08:39:14.049Z
Learning: Follow development quality standards defined in `CLAUDE.md` when using Claude Code for development assistance

Applied to files:

  • .github/workflows/claude.yml
  • .github/workflows/claude-code-review.yml
📚 Learning: 2025-12-01T03:45:17.253Z
Learnt from: CR
Repo: keito4/config PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-12-01T03:45:17.253Z
Learning: Applies to .github/workflows/ci.yml : Validate code quality in CI pipeline (.github/workflows/ci.yml) with linting, formatting, testing, and building

Applied to files:

  • .github/workflows/claude-code-review.yml
🪛 GitHub Actions: CI
.github/workflows/claude.yml

[warning] 1-1: Prettier formatting issues detected in this file. Run 'prettier --write' to fix.

.github/workflows/claude-code-review.yml

[warning] 1-1: Prettier formatting issues detected in this file. Run 'prettier --write' to fix.

🔇 Additional comments (5)
.github/workflows/claude-code-review.yml (3)

21-26: LGTM!

Permissions are appropriately scoped for a read-only review workflow. The id-token: write permission enables OIDC authentication with the Claude Code action.


28-32: LGTM!

Using fetch-depth: 1 is appropriate for code review workflows, optimizing checkout performance while providing all necessary context.


34-56: LGTM! Good alignment with repository standards.

The step configuration properly uses the v1 action with OAuth token authentication. The prompt correctly references CLAUDE.md for guidance on style and conventions, which aligns with the repository's development quality standards. The allowed-tools configuration appropriately restricts Claude to read-only gh commands plus gh pr comment for providing feedback.

Based on learnings, CLAUDE.md defines development quality standards that should be followed.

.github/workflows/claude.yml (2)

21-26: LGTM! Improved security posture.

Moving permissions from global scope to job level is a security best practice, providing explicit and minimal permissions. The actions: read permission is appropriately documented and enables Claude to access CI results on PRs.


33-49: LGTM! Proper migration to v1 action.

The changes correctly migrate from the beta version to v1:

  • Unified OAuth token authentication replaces separate API key and GitHub token
  • Added explicit step id for better workflow observability
  • The additional_permissions block properly grants Claude access to CI results

The commented claude_args example provides helpful guidance for future customization with explicit tool restrictions if needed.

Ensure the CLAUDE_CODE_OAUTH_TOKEN secret is configured in the repository settings. This secret replaces the previous ANTHROPIC_API_KEY and GITHUB_TOKEN configuration and is required for the v1 action to function.

Comment thread .github/workflows/claude-code-review.yml
@keito4
keito4 merged commit f268738 into main Dec 23, 2025
4 of 6 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.4.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@github-actions github-actions Bot added the released リリース済み label Dec 23, 2025
@keito4
keito4 deleted the add-claude-github-actions-1766472978967 branch January 4, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released リリース済み

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant