Agent Shipped

Guide · updated 2026-11-11 · 9 min read

Claude Code GitHub Actions: Set Up @claude in 10 Minutes

Claude Code GitHub Actions is a GitHub Action, anthropics/claude-code-action, that runs Claude Code on a GitHub runner whenever someone writes @claude in an issue or pull request comment. Setup is one command or about ten minutes by hand: install the Claude GitHub App, add one secret, commit one workflow file.

This guide covers both setup paths, the workflow YAML I would start from, how to keep the bill and the blast radius small, and what I would automate first. Everything here comes from the official GitHub Actions docs and the action's security doc, both read in November 2026.

What you actually get

The action has two modes, and it picks one from your workflow:

Most people start with interactive mode and add automation mode later. I would do the same.

Setup, option 1: the quick path

If you already use Claude Code locally, open it in the repo and run:

/install-github-app

You need admin access to the repo, and the GitHub CLI installed and logged in with gh auth login. The command works only with github.com repositories. It installs the app, saves your credential as a repository secret, then pushes a branch with the workflow files and opens a PR for you to create. Merge it and @claude works.

Setup, option 2: by hand

Use this if you do not run Claude Code locally, the command fails, or you want to read every line before it lands.

  1. Install the Claude GitHub App on the repo. The action relies on three of its permissions: Contents, Issues and Pull requests, each read and write. The app is shared with other Claude features, so GitHub makes you accept its whole permission set. If your org will not, the docs describe building a custom GitHub App with just those three.
  2. Add one secret under Settings, Secrets and variables, Actions: - ANTHROPIC_API_KEY: an API key from the Claude Console. - CLAUDE_CODE_OAUTH_TOKEN: a token tied to your Pro, Max, Team or Enterprise subscription. Generate it locally with claude setup-token.
  3. Commit the workflow below to .github/workflows/claude.yml.

The workflow YAML

This is the interactive-mode workflow from the docs:

name: Claude Code
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
jobs:
  claude:
    if: contains(github.event.comment.body, '@claude')
    runs-on: ubuntu-latest
    permissions:
      contents: write
      pull-requests: write
      issues: write
      id-token: write
      actions: read
    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 1
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}

The non-obvious lines:

Then test it. On any issue, comment something specific:

@claude the CSV export drops the last row when the file has no trailing newline. 
Find the cause, fix it, and add a test that fails before your fix.

Claude replies in the thread and works from there. One detail from the security doc: Claude does not open the pull request itself. It pushes a branch and gives you a link, and you click to create the PR. That is a feature, not a bug, because it puts a human between the agent and your review queue.

If it does not respond, the docs list the usual causes: the app is not installed, workflows are disabled, the secret is missing, you wrote /claude or @claude-bot instead of the exact word @claude, or the commenter lacks write access.

Cost control

Each run costs two things, per the docs: GitHub Actions minutes on the hosted runner, and tokens. With an API key you pay API rates. With an OAuth token, runs use your subscription instead, so they count against the same limits as your interactive use (see how usage limits work and which plan to pick).

The levers the docs name, in the order I reach for them:

  1. Cap turns. Add claude_args: "--max-turns 8" to the action's with: block. A run that loops on a flaky test stops instead of burning tokens.
  2. Set a job timeout. timeout-minutes: 15 on the job is a hard ceiling no matter what the agent does.
  3. Limit parallel runs. GitHub's concurrency: key means ten comments in a minute do not start ten jobs.
  4. Pick the model deliberately. --model goes in claude_args too. Without it you get the Claude Code default model.
  5. Write better requests. Specific requests need fewer turns. Issue templates that supply reproduction steps up front help more than any flag.
  6. Keep CLAUDE.md short. Claude reads it on every run, so every line is paid for every time. My notes on that are in how to write a CLAUDE.md.

I have not seen published per-run cost figures from Anthropic, so I will not quote one. Run it for a week, then read your Console usage or your plan's usage page.

Security: the part people skip

The defaults are sensible, and the docs spell them out:

One more gotcha that bites everyone once: if CI does not run on Claude's pushes, you probably passed github_token: ${{ secrets.GITHUB_TOKEN }}. GitHub does not trigger workflows from commits made with that token. Remove the line so the action authenticates as the Claude app.

What to automate first

My order, from lowest risk to highest:

1. Answer questions on issues. "@claude where is rate limiting implemented and what would break if I changed it?" Read-only value, nothing to review, and it teaches your team what a good request looks like.

2. Small, well-specified fixes. Typos, a failing test with a clear cause, a missing null check. Insist on a test in the request. Review the branch like any other.

3. PR review on open. This is automation mode. The docs' example installs the code-review plugin and runs /code-review:code-review --comment on opened, synchronize, ready_for_review and reopened. Two details matter: without --comment, Claude posts nothing and you only see findings in the run log, and the claude_args line naming mcp__github_inline_comment__create_inline_comment must stay because it is what starts the inline-comment tool. The docs also point to Code Review as a hosted option if you do not want to maintain a workflow file.

4. Scheduled reports. A daily summary of commits and open issues on a cron trigger, limited with --allowedTools "mcp__github__list_commits,mcp__github__list_issues". Scheduled workflows only run from the default branch, and on public repos GitHub disables the schedule after 60 days without repo activity.

5. Your own skills in CI. Put a skill in .claude/skills/, check out the repo, and pass /skill-name as the prompt. If you have already built a release-notes or triage skill locally, this is the cheapest way to make it run unattended. See building skills.

I would not start with "implement every issue labeled agent." Unattended implementation works when your issues are crisp and your tests are good. Before then, it generates plausible branches you have to untangle.

Smaller notes

Bottom line

Install the app, add one secret, commit the YAML above, and start with read-only questions. Add --max-turns and a job timeout on day one, keep write access tight, and graduate to PR review before you let it write code unattended. Do all of that and Claude Code GitHub Actions is a cheap way to get a second pair of hands on every issue.

If you want more setups like this twice a week, subscribe to Agent Shipped (Free · twice a week · 4-minute read).

FAQ

How do I set up Claude Code GitHub Actions?

Run /install-github-app inside Claude Code in your repo, or install the Claude GitHub App, add an ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN secret, and copy the example claude.yml into .github/workflows/. You need admin access to the repository. Then comment @claude on an issue to test it.

Does Claude Code GitHub Actions cost extra?

Each run uses GitHub Actions minutes on the runner plus Claude tokens. With an API key you pay API rates; with a subscription OAuth token the runs draw on your Claude plan instead. You can cap both with --max-turns, job timeouts and concurrency controls.

Can anyone on my repo trigger @claude?

By default only users with write access can, and bots are rejected unless you list them in allowed_bots. The allowed_non_write_users input bypasses the write check and the docs call it a significant security risk.

Why don't my CI checks run on Claude's commits?

GitHub does not trigger workflows on commits made with the default GITHUB_TOKEN. If you passed github_token: ${{ secrets.GITHUB_TOKEN }} to the action, remove it so Claude authenticates as the Claude GitHub App.

Get the field guide

Join builders who use coding agents every day. Free, twice a week, unsubscribe in one click.

No spam. The CLAUDE.md starter pack comes in your confirmation email. Not seeing it? Check spam or Promotions.

Keep reading