Guide · Claude Code for teams
How do you run Claude Code in GitHub Actions for a team?
Add Anthropic's claude-code-action to a workflow and give it one credential as a
GitHub secret. For a secret shared across repositories, Anthropic advises a Claude Console API
key, not a subscription token, because a subscription token belongs to whoever created it. Cap
each run with --max-turns and a job timeout. Through Selan, each job carries a
token of its own.
How do you set up Claude Code in GitHub Actions?
Run /install-github-app inside Claude Code, in the repository you want to
connect. It installs the Claude GitHub App, saves your credential as a repository secret and
opens a pull request with the workflow file.
You need admin access to the repository and the GitHub CLI signed in with
gh auth login. The command works only for github.com repositories.
The manual route is the same three pieces: install the app, add the secret, and copy
examples/claude.yml from the action's repository into
.github/workflows/.
The action runs in one of two modes:
- Interactive: with no
promptinput, it waits for@claudein an issue or pull request comment and answers there. - Automation: with a
promptinput, it runs on the workflow's event, such as a schedule, and writes to the run log by default.
By default, only a user with write access to the repository can trigger it on an issue or pull request.
A bot cannot, unless it is listed in allowed_bots.
Which credential should the workflow use?
Anthropic's documentation names four ways for the action to authenticate:
| Credential | Where it comes from | Who pays |
|---|---|---|
ANTHROPIC_API_KEY | An API key from the Claude Console | The Console organisation, per token |
CLAUDE_CODE_OAUTH_TOKEN | claude setup-token, valid for one year, on Pro, Max, Team or Enterprise | The subscription of the person who ran it |
| Workload identity federation | The workflow's GitHub OIDC token, exchanged for access through a Console service account | The Console organisation, per token |
| Bedrock, Google Cloud or Foundry | OIDC federation into your own cloud account | Your cloud account |
For an organisation, Anthropic suggests installing the app once, storing the secret at the organisation level, and calling one reusable workflow from each repository.
Federation stores no long-lived secret at all. It needs the id-token: write
permission on the workflow.
A secret every repository shares should belong to the company, not to whoever ran setup-token.
What does a run cost, and how do you cap it?
Each run uses two things:
- GitHub Actions minutes on GitHub-hosted runners, billed by GitHub.
- Model tokens, which grow with the prompt, the task and the size of the codebase. With an OAuth token, runs use that person's Claude subscription instead of API billing.
Anthropic's own advice for keeping both down:
- Set
--max-turnsinclaude_argsto bound how long Claude works. - Set
timeout-minuteson the job, so a runaway run ends. - Use GitHub's
concurrencycontrols to limit parallel runs. - Keep
CLAUDE.mdshort, because Claude reads it on every run.
None of these is a budget. A turn limit bounds one run; it does not stop the hundredth run in a month. What a developer's Claude Code costs a day is in the cost-per-developer guide.
What changes when every repository runs it?
One secret shared by every repository means every run bills to one credential. A subscription token is one person's plan doing the whole organisation's CI.
Turn limits and timeouts bound each run, not the total across every repository and job.
How does Selan run Claude Code in GitHub Actions?
With a plain run step instead of the action. The job installs selan and Claude
Code, then runs an agent from the repository's .claude/agents/ with
selan agent-run, signed in by a SELAN_TOKEN secret.
- name: Install selan and Claude Code
shell: bash
run: |
curl -fsSL https://dl.selan.ai/install.sh | sh
npm install -g @anthropic-ai/claude-code
- name: Review
continue-on-error: true
timeout-minutes: 20
env:
SELAN_TOKEN: ${{ secrets.SELAN_TOKEN }}
run: selan agent-run code-review "Review this pull request. Write it to $GITHUB_WORKSPACE/review.md."
- No provider key in GitHub. The company's provider accounts stay on Selan, and the job holds only its token.
- A token per job. An owner mints each one under Settings → API tokens. It spends as itself, under an address like
ci-review@tokens.selan.ai, so its runs show up as that job in Usage and Logs. - A limit per job. The company's per-person spend limit applies to a token as it does to a person, and a token can be given a limit of its own. How limits work is on the spend page.
- API keys only, if you want. An owner can switch a token to API only. Selan then serves it only from the company's own API keys and skips every connected subscription account.
- One revoke. Revoking a token ends that job's access without touching any other job.
A complete workflow, with the step that posts the review, is on the code review page. GitLab CI needs more than a path change: container images run as root, which Claude Code refuses with permissions skipped, so the job drops to a user. That pipeline is on the same page. How the token works is in Agents in CI.
selan agent-run skips every permission prompt,
because nobody is there to answer one. Treat what the runner can reach as the boundary. The
precautions are in skipping permissions safely.
When is Anthropic's action the better choice?
When you want @claude in comments. The action answers a mention in the thread,
shows its progress in a comment there and can push commits as the Claude GitHub App. Selan's
documented route writes a file, and the pipeline decides what to post.
When one repository uses it, a single API key in one secret is simple and enough. Selan earns its place once several repositories and jobs share the bill and you want each one shown and capped on its own, next to the people on the team.
Free for up to three seats, and the Free plan needs no card. A CI token takes a seat of its own on a paid plan; the Free plan is people only.
The short version
/install-github-appinstalls the Claude GitHub App, saves a secret and opens the workflow pull request.- A subscription token belongs to the person who made it; for a secret shared across repositories, Anthropic advises a Console API key, and federation stores none.
- Cap each run with
--max-turns, a job timeout and a concurrency group. - Through Selan, each job carries its own token, shows up as itself in Usage and can have a limit of its own.
How the action works is as Anthropic's GitHub Actions and authentication documentation (code.claude.com/docs/en/github-actions and /authentication) stated it on 26 October 2026. It changes: check the date before relying on it. What Selan does is as its CLI, control app and docs stated it on that date.