Claude Code GitHub Actions: setup, workflows and safe limits
How to set up Claude Code GitHub Actions, the three workflows worth starting with, what a run costs, and the limits that keep it safe in a real repo.
Short answer
Claude Code GitHub Actions runs Claude inside a GitHub workflow, so you can mention @claude in an issue or pull request, or trigger it on events like a new PR, and it reads the repo, writes code or comments, and opens a pull request. You set it up with /install-github-app in Claude Code or by adding the anthropics/claude-code-action workflow and an API key secret yourself. Start with review comments and small fixes, cap the turns, and keep a human merging every pull request.
Key takeaways
- Claude Code GitHub Actions puts Claude in your GitHub workflow: it answers @claude mentions and can run on events like a new pull request.
- The fastest setup is /install-github-app inside Claude Code; the manual route is the GitHub app, an API key secret and one workflow file.
- A run costs two things: GitHub Actions runner minutes and the model tokens Claude uses.
- Your CLAUDE.md file is the brief Claude follows in CI, so the quality of that file decides the quality of the output.
- Limit turns and tools, scope the permissions, and never let Claude merge its own pull request.
A Claude Code session on your laptop helps one person. The same agent inside GitHub helps everyone who opens an issue or a pull request, including the people who never open a terminal.
That is what Claude Code GitHub Actions does. You mention @claude in a comment, or a pull request comes in, and a workflow starts Claude on a GitHub runner. It reads the code, does the work and answers in the thread.
This guide covers how it works, how to set it up, which workflows to start with, what it costs and where I would draw the limits.
What is Claude Code GitHub Actions?
Claude Code GitHub Actions is an official GitHub Action from Anthropic that runs Claude Code inside a GitHub workflow, so Claude can respond to issues and pull requests without anyone running it locally. The action lives in the anthropics/claude-code-action repository and is open source.
It works in two ways. The first is interactive: someone writes @claude in an issue or pull request comment, and Claude picks up the request. The second is automated: you give the workflow a fixed prompt and a trigger, such as every new pull request, and Claude runs without anyone asking.
Under the hood it is the same Claude Code you use in the terminal. It runs in a fresh environment on a GitHub runner, it reads your CLAUDE.md, and it works through tools like reading files, editing them and running commands. The difference is that nobody is watching the session live. The output is a comment, a commit on a branch or a pull request.
How is it different from routines and claude -p?
Claude Code GitHub Actions runs on GitHub's infrastructure and is built around issues and pull requests, while routines run on Anthropic's cloud and claude -p runs wherever you call it. All three are ways to run Claude without a person typing.
| Option | Where it runs | Best for |
|---|---|---|
| GitHub Actions | A GitHub runner, inside your repo's workflows | Work that starts in an issue or pull request |
| Routine | Anthropic's cloud | Scheduled or API-triggered tasks across repos and connectors |
claude -p in cron or a script |
Your own server or machine | Tasks that need local files, tools or networks |
If the work starts and ends in GitHub, Actions is the natural fit. Your team already lives there, the permissions already exist and the review flow is already built. For scheduled business tasks that are not about code, look at Claude Code routines instead. For scripts on your own server, see the -p flag in the Claude Code commands overview.
How do you set up Claude Code GitHub Actions?
The quickest way to set up Claude Code GitHub Actions is to run /install-github-app inside Claude Code, which installs the GitHub app, stores your API key as a secret and adds the workflow file. You need admin rights on the repository.
If you prefer to do it by hand, or the quick setup does not fit your account, these are the steps:
- Install the Claude GitHub app on the repository. It needs read and write access to contents, issues and pull requests.
- Add your API key as a secret. In the repository settings, add
ANTHROPIC_API_KEYunder Actions secrets. Never paste the key into the workflow file itself. - Add a workflow file. Copy the example from the
anthropics/claude-code-actionrepository into.github/workflows/claude.yml. It listens for comments that mention@claude. - Write or update
CLAUDE.md. This is the brief Claude reads on every run. Put your coding standards, test commands and what it must never touch in there. - Test it on a small issue. Open an issue, write
@claude explain what this function does, and watch the run in the Actions tab.
A minimal workflow for the interactive mode looks like this:
name: Claude
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
steps:
- uses: actions/checkout@v4
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: "--max-turns 10"
Check the action's README before you copy this. Input names change between versions, and the README is the source of truth. You can also run it through Amazon Bedrock or Google Vertex AI if your company keeps model access there.
Which workflows should you start with?
Start with workflows where Claude writes something a person reads before anything changes: an answer, a review comment or a draft pull request. These are the ones I would try first, in this order.
| Workflow | Trigger | What Claude does | Risk |
|---|---|---|---|
| Ask the codebase | @claude in an issue |
Explains code, finds where something lives | Very low |
| Pull request review | Every new or updated PR | Comments on bugs, missing tests, rule breaks | Low |
| Small fixes from issues | @claude with a clear request |
Makes the change on a branch, opens a PR | Medium |
| Docs and changelog | Merge to main | Drafts release notes or updates docs in a PR | Low |
Ask the codebase is the underrated one. A product manager or support person can ask how a feature works without pulling a developer away. Nothing gets changed. It is a good way to see how well your CLAUDE.md holds up.
Pull request review is where most teams start. Give it a narrow prompt. "Review this PR" gives you a wall of generic comments. "Flag security issues, missing tests and anything that breaks the rules in CLAUDE.md" gives you comments people act on.
Small fixes need the clearest issues. Say a 10-person team has a backlog of typo fixes, small copy changes and obvious bugs. Each one becomes an issue with @claude and a precise request, and the output is a pull request someone reviews in two minutes. Vague issues produce vague pull requests.
What does a Claude Code GitHub Actions run cost?
A run costs GitHub Actions minutes for the runner plus model usage for the tokens Claude reads and writes. The action itself is free and open source.
On the GitHub side, standard GitHub-hosted runners are free for public repositories, and private repositories get an included monthly allowance. According to GitHub's billing docs, the Free plan includes 2,000 minutes a month for private repositories. A typical review run takes a few minutes, so minutes are rarely the bottleneck for a small team.
Model usage is the bigger number, and it grows with the size of the repo and the length of the task. A run that reads half the codebase to answer one question costs more than it should. Three settings keep it under control:
- Max turns. Pass
--max-turnsinclaude_argsso a confused run stops instead of looping. - Model choice. Use a smaller, faster model for routine reviews and the stronger model for real code changes.
- Narrow triggers. Do not run a full review on every push to every branch. Run it when a pull request opens or is marked ready.
Look at the token usage of your first twenty runs before you widen anything. That gives you a real cost per run instead of a guess.
How do you keep Claude safe in your repository?
You keep Claude safe in a repository by limiting what it can touch, what it can run and what it can finish without a person. The action can write code and push branches, so treat it like a new team member with commit access.
These are the limits I would set from day one:
- A human merges every pull request. Use branch protection on main so no change lands without an approving review. Claude proposes, people decide.
- Scope the workflow permissions. Give the job only the permissions it needs. A review workflow does not need to push code.
- Limit the tools. Use the allowed tools setting in
claude_argsso Claude can only run the commands the task requires, like your test command. - Keep secrets out of reach. Only pass the secrets the job needs. Claude can read anything the runner can read.
- Decide who can trigger it. On a public repository, anyone can write a comment. Make sure only people with write access can start a run that changes code.
- Read the runs. Every run leaves a log in the Actions tab. Read them for the first weeks, the same way you would for any agent in production.
This matters because adoption is moving faster than review habits. According to the 2025 Stack Overflow Developer Survey, 84% of developers now use AI tools or plan to start. More AI-written code means more code to review, not less.
How do you make the output better over time?
You make the output better by improving CLAUDE.md, not by rewriting prompts in every workflow file. Claude reads that file on every run, so one fix there improves every future review and pull request.
When a review comment misses the point, ask why. Usually the rule Claude should have applied was never written down. Add it to CLAUDE.md in one plain sentence. When a pull request touches files it should not, add that boundary too. How to keep that file short and structured is covered in the Claude Code memory article.
The pattern is the same as in every agent I build. Start with the lowest-risk task, read the output, write down what was missing and only then give it more room. GitHub makes that easy, because every step already leaves a comment, a commit or a log behind.
Frequently asked questions
How do I set up Claude Code GitHub Actions?
Open Claude Code in the repository and run /install-github-app. It walks you through installing the Claude GitHub app and adding your Anthropic API key as a repository secret, then adds a workflow file. You need admin rights on the repository. You can also do it by hand: install the app, add the ANTHROPIC_API_KEY secret and copy the example workflow from the anthropics/claude-code-action repository.
Is Claude Code GitHub Actions free?
The action itself is open source, but a run is not free. It uses GitHub Actions minutes on the runner and model usage on your Anthropic API key or Claude plan. Public repositories get free minutes on standard GitHub-hosted runners, and private repositories get a monthly allowance that depends on your GitHub plan.
What can you do with @claude in GitHub?
When the action is installed, you can mention @claude in an issue or pull request comment and ask it to explain code, review a change, fix a bug or implement a small feature. Claude reads the repository, does the work on a branch and replies in the thread, often with a pull request you can review.
Can Claude Code review pull requests automatically?
Yes. Instead of waiting for a mention, you can trigger the workflow on pull_request events and give it a prompt that tells Claude what to review. It then comments on every new or updated pull request. Keep the prompt narrow, for example security issues and missing tests, so the comments stay useful.
Does Claude Code GitHub Actions read CLAUDE.md?
Yes. Claude follows the CLAUDE.md file in your repository when it runs in a workflow, just as it does in the terminal. Put your coding standards, review criteria and project rules there, so every run starts with the same context.
- /21 oct 2026
Claude Code for non-developers: what to learn in your first week
Claude Code for non-developers: what you need to install, the few terminal ideas that matter, a first-week plan and the safety rules that keep it boring.
- /15 oct 2026
Claude Code for marketing: a setup for teams that don't code
How to use Claude Code for marketing work: the files to set up first, six workflows that fit, a step-by-step start and what to keep human.
- /14 oct 2026
Claude Code routines: let Claude work while your laptop is off
What Claude Code routines are, the three triggers that start them, how to set up your first one, and which recurring business tasks fit a routine.
