How it works
Claude Code GitHub Actions or your own server?
Published · 6 min read· Anton Shubin

In short
- Claude Code GitHub Actions runs Claude Code on GitHub's runners when someone mentions @claude or an event fires, and a job there stops at 6 hours.
- Both can bill an API key or a Claude subscription; for a secret the whole team shares, Anthropic's docs advise an API key.
- Your own server pays off when one person runs long, queued runs all week on a subscription, next to the CI.
- A team that wants no machine to look after should pick the Action.
Claude Code GitHub Actions or self-hosted comes down to one question: do you want a machine to keep?
Pick the Action if your team wants Claude Code to answer @claude in issues and pull requests and
nobody wants to look after a server. Pick your own server if one person wants long unattended runs
that work through a queue of GitHub issues on a Claude subscription, all week. I run the second
kind, on my own machine, across 11 of my projects.
What does each one run, and where?
Both run Claude Code itself. The difference is who starts it and on which computer.
Claude Code GitHub Actions "runs Claude Code
inside your repository's workflows" (checked 2026-12-01). It "runs on GitHub-hosted runners, which
consume your GitHub Actions minutes" (checked 2026-12-01). Setup is one command,
/install-github-app, run from Claude Code. It opens GitHub with a pull request for the workflow
file, ready for you to create (checked 2026-12-01). It has two modes. With no prompt, it waits for
@claude in a comment, a review, or the title or body of a new issue. With a prompt, it runs on
any event you wire up, a schedule included, and by default writes its result to the workflow run log
(both checked 2026-12-01).
My setup is a small program on my own machine that starts claude -p for each run, in its own
systemd unit, and records everything in Postgres. How the loop works, from issue to merge, is in
Running Claude Code unattended on GitHub issues.
It is Issuemill, free under AGPL-3.0; the source opens later.
| Claude Code GitHub Actions | Your own server | |
|---|---|---|
| Where Claude Code runs | GitHub-hosted runner (Anthropic, checked 2026-12-01) | Your machine |
| What starts a run | @claude, a new issue, or any workflow event (Anthropic, checked 2026-12-01) |
Code that picks the next issue |
| Who may start one | Users with write access; bots only if listed in allowed_bots (Anthropic, checked 2026-12-01) |
You |
| Tokens | API key, subscription token, Amazon Bedrock, Google Cloud or Microsoft Foundry (Anthropic, checked 2026-12-01) | API key or subscription token |
| Compute, private repository | $0.006 a minute on Linux 2-core (GitHub, checked 2026-12-01) | Your server's monthly price |
| Compute, public repository | Free (GitHub, checked 2026-12-01) | Your server's monthly price |
| Longest job | 6 hours on a GitHub-hosted runner (GitHub, checked 2026-12-01) | Whatever deadline you set |
| Machine to keep | None | Yours, updates and all |
Who pays for the tokens?
Both can bill either an API key or your Claude subscription. The Action takes ANTHROPIC_API_KEY or
CLAUDE_CODE_OAUTH_TOKEN, "an OAuth token that authenticates with your Claude subscription", on
Pro, Max, Ultra, Team and Enterprise (Anthropic, checked 2026-12-01). My runs take the same
kind of token, made with claude setup-token, which the docs describe as for "CI pipelines,
scripts, or other environments" (Anthropic, authentication, checked 2026-12-01).
The catch is whose subscription it is. Anthropic's docs tell you to use an API key "rather than an
OAuth token" for a secret shared across repositories, because the token "is tied to the subscription
of the person" who made it (Anthropic, checked 2026-12-01). In a team repo, every teammate's
@claude would spend one person's weekly quota.
The rule behind that sits in the Consumer Terms,
which cover Pro, Max and Ultra. They forbid using the service "through automated or non-human
means", except through an API key "or where we otherwise explicitly permit it" (checked 2026-12-01).
The Claude Code legal page adds that plan
limits "assume ordinary, individual usage" (checked 2026-12-01). I found no page that says in one
sentence "run claude -p on your own subscription for your own work". My reading is that a
documented token for CI and scripts, used by one person on their own repositories, is that
permission. That is my reading, not a quote.
So for one person on a subscription, the two are equal on tokens. For a team, both want an API key, and the Action makes that easier: one org secret and you are done.
How long can a run be?
On a GitHub-hosted runner, "each job in a workflow can run for up to 6 hours of execution time" (GitHub, checked 2026-12-01). Anthropic's own advice is to "set workflow-level timeouts to avoid runaway jobs" (Anthropic, checked 2026-12-01). GitHub lets a job run on a self-hosted runner too, for up to 5 days (GitHub, checked 2026-12-01), but then you keep a machine anyway.
Six hours is more than I give my own runs. A lead run gets a deadline of 3 hours, set as the systemd
unit's RuntimeMaxSec. The length was never my problem. The ending was.

A run that is cut off mid-thought leaves a half-done branch and nobody who knows why. So my
supervisor advises a lead run to hand off 90 minutes in, and in its last 15 minutes asks it to stop
starting new work, commit, push, comment on the issue and park with a full handoff. A parked run is
continued later by a fresh run that reads that handoff. One that still runs at the deadline ends as
timeout and counts as a failed attempt.
The unit also cleans up after itself. It kills every process the run started when it ends
(KillMode=control-group), caps memory at 8 GB (MemoryMax=8G) and processes at 4,000
(TasksMax=4000). A test server that Claude forgot to stop does not live on until I notice it next
week.
With the Action you can build all of this too: --max-turns, a workflow timeout and a prompt that
says "push before you run out of time". You just build it yourself.
Who picks the next issue?
With the Action, a person does. Someone types @claude, or an event fires, and each one is its own
run. Anthropic suggests "GitHub's concurrency controls to limit parallel runs"
(Claude Code GitHub Actions, checked 2026-12-01).
There is no queue, so two people can point Claude at two issues that touch the same file, and
nothing ranks what matters this week.
On my machine, code picks. A dispatcher checks every 15 seconds for a free slot. When one opens, the queue puts issues that unblock other issues first, then ranks projects by how long they have waited, by "Focus today", and by each project's share of run hours. A second lead run on an issue that already has one is refused. The queue page has the whole order.
That ranking is the part I would miss most. It is also the part you do not need if your team already decides by hand, every morning, what Claude works on.
Pick the Action if…
- Your team wants no machine to keep. No updates, no disk filling up, no 3 a.m. reboot.
- People want to ask Claude for one thing at a time, in the issue or pull request they are reading.
- Several people trigger runs. One org secret with an API key fits that, as Anthropic advises.
- Your repository is public, where GitHub-hosted minutes cost nothing.
- Your runs are short. A review or a small fix finishes long before 6 hours.
This is most teams. I would set it up for a team of five before I set up a server for them.
Pick your own server if…
- One person runs many issues, all week, on their own subscription, and wants the weekly quota spent evenly. My queue weighs each account's weekly pace when it ranks projects.
- Runs are long and should continue where they stopped, with a deadline and a handoff instead of a cancelled job.
- Your CI runs on the same machine. My dispatcher holds new runs while CPU pressure or the number of pending CI workflows is above the limits I set, so Claude and the test suite do not fight over cores. Then it merges when CI is green, reading GitHub's own check results.
- You want code to decide what runs next across many repositories.
- You are fine being the on-call engineer for a machine. A Hetzner CPX32 (4 vCPU, 8 GB) is € 30.49 a month with a hard price cap (Hetzner, checked 2026-12-01), and it will still need you the day an update breaks something.
The token from claude setup-token lasts a year, and the docs warn that "renewing early matters
most for sessions that run unattended" (Anthropic, authentication, checked 2026-12-01). Put
that date in your calendar. My machine does not care how good my queue is when its login has
expired.


