Claude Code GitHub Actions | A Minimal Setup Guide for @claude Triggers

For developers who want to use Claude Code GitHub Actions in real projects, this guide covers how to integrate Anthropic's official Action that automates code reviews, implementations, and fixes via @claude mentions. From the 5-minute setup using /install-github-app to 4 workflows spanning PR reviews, scheduled runs, Issue implementation, and design discussions — plus the key points of the v1 migration — everything is explained with practical examples.

Article Summary by AI Chatpowered by Claude
結論powered by Claude

Claude Code GitHub Actions is Anthropic's official Action where Claude responds to @claude mentions with PR reviews, implementations, and fixes. Running /install-github-app in the Claude Code CLI automatically sets up the GitHub App, API key, and sample Workflow files, completing the setup in 5 minutes.

In v1, specifying mode: tag / mode: agent is no longer required — the Action automatically determines the mode — so a minimal 10-line Workflow using the single prompt interface covers all 4 use cases: automatic PR reviews, scheduled runs, Issue implementation, and design discussions.

The claude_args parameter accepts Claude Code CLI options directly, allowing you to inject coding standards via --append-system-prompt. Note that the default model is Sonnet — to use Opus 4.7, you must explicitly specify claude_args: --model claude-opus-4-7.

目次 (11)

What Is Claude Code GitHub Actions — Anthropic's Official Action That Runs on @claude

This is Anthropic's official Action (anthropics/claude-code-action@v1) for calling Claude Code from GitHub Actions workflows. Simply mention @claude in a PR or Issue comment, and Claude will analyze the code, implement changes, apply fixes, or create PRs.

Claude respects the coding standards defined in CLAUDE.md, making it easy to set up context-aware automation aligned with your repository. Since it runs on GitHub-hosted runners, your source code never leaves the repository.

Quickest Setup — 5 Minutes with /install-github-app

Here are the key points for this section.

# Run a single command in Claude Code CLI (requires repository admin permissions)
/install-github-app

This command guides you interactively through installing the GitHub App, registering ANTHROPIC_API_KEY, and placing sample Workflow files. Once complete, write @claude in an Issue or PR comment to confirm it's working.

If /install-github-app fails or you need to customize the setup, you can configure it manually in 3 steps:

  1. Install the Claude GitHub App: Go to https://github.com/apps/claude and install it on the target repository
  2. Register ANTHROPIC_API_KEY as a repository secret: Settings → Secrets and variables → Actions
  3. Place the Workflow file: Copy examples/claude.yml from anthropics/claude-code-action into .github/workflows/

Minimal Workflow — Enable @claude Auto-Response in 10 Lines

The minimal configuration shown in the official documentation is as follows:

name: Claude Code
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
jobs:
  claude:
    runs-on: ubuntu-latest
    steps:
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

This enables automatic responses to @claude mentions in comments. In v1, specifying mode: tag / mode: agent is no longer needed — the Action automatically determines the mode.

For fine-grained behavior control, you can pass Claude Code CLI options directly via the claude_args parameter.

- uses: anthropics/claude-code-action@v1
  with:
    anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
    prompt: "Review this PR for security issues"
    claude_args: |
      --append-system-prompt "Follow our coding standards"
      --max-turns 10
      --model claude-sonnet-4-6

4 Standard Workflows — PR Review / Scheduled Run / Issue Implementation / Design Discussion

Here are the key points for this section.

Workflow Trigger Example Prompt
① Automatic PR Review pull_request: [opened, synchronize] "Review this pull request for code quality, correctness, and security."
② Scheduled Run schedule: cron "0 9 * * *" "Generate a summary of yesterday's commits and open issues"
③ Issue → Code Implementation issue_comment with @claude implement ... The comment body serves as the instruction
④ Design Discussion issue_comment with @claude how should I ... The comment body serves as the instruction

① and ② are automation-mode workflows that specify prompt explicitly in the Workflow YAML, while ③ and ④ are interactive-mode workflows that respond to @claude mentions — in v1, the mode is determined automatically. The following 3 comment examples are most representative:

@claude implement this feature based on the issue description
@claude how should I implement user authentication for this endpoint?
@claude fix the TypeError in the user dashboard component

Model Selection — Sonnet by Default, Opus 4.7 Requires Explicit Specification

The default model in v1 is Sonnet. To use Opus 4.7, you must specify it explicitly by passing claude_args: --model claude-opus-4-7.

If accuracy on coding tasks is the priority, Opus 4.7 is the starting point; if cost optimization matters more, Sonnet is the baseline. Since token consumption depends on task complexity and repository size, setting a conversation turn limit with --max-turns N is standard practice.

beta → v1 Breaking Changes Checklist

If you are using the beta version, you will need to rewrite your Workflow files to upgrade to v1.

beta input v1 input
mode Removed (auto-detected)
direct_prompt prompt
override_prompt prompt (combined with GitHub variables)
custom_instructions claude_args: --append-system-prompt
max_turns claude_args: --max-turns
model claude_args: --model
allowed_tools claude_args: --allowedTools
disallowed_tools claude_args: --disallowedTools
claude_env settings JSON format

The two key takeaways are: all CLI options are consolidated under claude_args, and everything is unified under the single prompt interface.

Cost Management — Double Billing for GitHub Actions Minutes + Claude API Tokens

Here are the key points for this section.

  • GitHub Actions billing: Consumes hosted runner execution time (billed by the minute)
  • Claude API billing: Pay-per-use based on token count (input + output)
  • Runaway prevention: claude_args: --max-turns N is essential (default 10; use 10–15 for complex tasks, 3–5 for reviews)
  • Job level: Add timeout-minutes: alongside
  • Parallel limits: Use GitHub Actions concurrency controls

A common pitfall is token costs ballooning when --max-turns is not set for simple reviews.

5 Things to Check When @claude Doesn't Respond

The majority of cases where the bot doesn't respond come down to one of the following. Check in order from the top.

  1. Is the GitHub App correctly installed on the target repository?
  2. Are Actions enabled for the repository?
  3. Is ANTHROPIC_API_KEY registered as a secret?
  4. Does the comment contain @claude (not /claude)?
  5. If CI doesn't run on Claude's commits, are you using the GitHub App or a custom App? (CI triggers do not fire with the Actions user by design)

Switching to AWS Bedrock / Google Vertex AI

For enterprise use cases where you want data residency and billing routes aligned with your own Cloud account, you can switch by specifying use_bedrock: "true" or use_vertex: "true". The recommended setup for the former uses OIDC to assume an IAM Role, while the latter uses Workload Identity Federation to assume a service account.

As a prerequisite, Claude model access must be enabled in Bedrock / Vertex AI. Refer to the official documentation for detailed setup instructions.

Sources (Primary Information)

The primary sources referenced directly in writing this article are listed below. Always check the links for the latest and most accurate information.

参考になったら ♡
Clauder Navi 編集部
@clauder_navi

Anthropic の Claude / Claude Code を中心に、日本のエンジニア向けに最新動向と実務 を毎日発信。 運営方針 は メディアについて をご覧ください。