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:
- Interactive mode. No
promptinput. Claude waits for the trigger phrase (@claudeby default) in an issue comment, PR comment, PR review, or a new issue's title or body, then replies in a comment on that thread and updates it as it works. - Automation mode. You pass a
prompt. Claude runs on whatever event you chose (a PR opening, a cron schedule) without waiting for a mention. Output goes to the workflow run log unless your prompt tells Claude to post somewhere and it has a tool that can.
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.
- 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.
- 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 withclaude setup-token. - 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:
id-token: writeis required for the action's default GitHub App authentication.actions: readlets Claude read CI results on a PR, which is how it can react to a failing test.- The
if:stops runners from spinning up on comments that never mention Claude, which saves minutes. - If you chose the subscription token, swap the last line for
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}.
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:
- Cap turns. Add
claude_args: "--max-turns 8"to the action'swith:block. A run that loops on a flaky test stops instead of burning tokens. - Set a job timeout.
timeout-minutes: 15on the job is a hard ceiling no matter what the agent does. - Limit parallel runs. GitHub's
concurrency:key means ten comments in a minute do not start ten jobs. - Pick the model deliberately.
--modelgoes inclaude_argstoo. Without it you get the Claude Code default model. - Write better requests. Specific requests need fewer turns. Issue templates that supply reproduction steps up front help more than any flag.
- 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:
- Only users with write access can trigger a run. Bots are rejected unless listed in
allowed_bots. allowed_non_write_usersbypasses the write check. The security doc calls this "a significant security risk" and says to use it only for workflows with extremely limited permissions. On a public repo, I would not use it at all.- Prompt injection is real. The doc warns that external contributors can hide instructions in HTML comments, invisible characters or hidden attributes, and says new bypass techniques may emerge. Read the raw content of anything from an outsider before tagging Claude on it.
- Keep
permissions:minimal. The review workflow in the docs uses read-only contents and pull requests. - Never paste a key into the YAML. Secrets only.
- Commits are unsigned by default.
use_commit_signing: truegives verified commits through the GitHub API, but the doc notes it cannot rebase or cherry-pick. - Leave
show_full_outputoff. On public repos those logs are publicly visible.
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
- Hooks and local rules. Your repo's
.claude/config carries over to the runner, so project hooks can enforce lint and test gates in CI too. Examples are in 8 copy-paste hooks. Per the security doc, on PRs the action restores.claude/,.mcp.jsonandCLAUDE.mdfrom the base branch, not the PR head, so a PR cannot rewrite its own rules. - Cloud providers. Set
use_bedrock,use_vertexoruse_foundryto"true"and authenticate through OIDC federation instead of an API key. The docs have a separate page for each. - Orgs. Install the app once at the org level, store the secret as an org-level Actions secret, and use an API key rather than an OAuth token for it, since the token belongs to whoever ran
claude setup-token. - Upgrading from beta. Change
@betato@v1, dropmode, renamedirect_prompttoprompt, and move options likemodelintoclaude_args.
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.