Claude Code GitHub Actions: setup, workflows and auth
anthropics/claude-code-action@v1: /install-github-app, @claude and prompt workflows, claude_args, API key or setup-token, Bedrock via OIDC, permissions, costs.
Claude Code runs in GitHub Actions through Anthropic’s action, anthropics/claude-code-action@v1 (newest release v1.0.287, November 23, 2026). The quickest setup is to run claude in the repository and type /install-github-app: it installs the Claude GitHub App, saves your credential as a repository secret and opens a pull request with the workflow files. Without a prompt input, the action answers @claude in issue and pull request comments; with one, it runs on whatever event the workflow names, a cron schedule included. Extra Claude Code flags go in claude_args. It signs in with an ANTHROPIC_API_KEY secret (API billing), a CLAUDE_CODE_OAUTH_TOKEN from claude setup-token (your Pro, Max, Ultra, Team or Enterprise plan), or through OIDC with no stored key, to Anthropic or to Bedrock, Google Cloud or Foundry. By default only users with write access can trigger it.
Quick setup with /install-github-app
You need admin access to the repository, a github.com remote (the command exits on GitLab and Bitbucket), and the GitHub CLI signed in with gh auth login. Per Anthropic’s GitHub Actions page:
- Run
claudein the repository and enter/install-github-app. If it reports missing GitHub CLI permissions, run the command it prints and start again. - Install the Claude GitHub App on the repository in the browser that opens, then press Enter in Claude Code.
- Select Set up GitHub Actions workflows and keep the
@claudementions workflow, the pull request review workflow, or both. If the repository already has aclaude.yml, choose Skip workflow update (configure secrets only) to keep yours. - Choose the credential: a long-lived token made with your Claude subscription, or an API key you paste. It is saved as the secret
CLAUDE_CODE_OAUTH_TOKENorANTHROPIC_API_KEY. - Confirm with Yes, make these changes. Claude Code pushes a branch and opens GitHub on a pull request ready to create. Create it and merge it; the workflows run from then on.
Esc stops setup part way, and the closing message lists what was already done, such as a pushed branch or a saved secret. The review workflow it writes, and how it differs from Anthropic’s managed reviews, is covered in Claude Code review.
The @claude workflow, set up by hand
Install the app, add the secret as a repository Actions secret, and put this in .github/workflows/claude.yml. It is Anthropic’s example as published:
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 }}Copiedid-token: writeis needed even with an API key: the action’s default sign-in to GitHub as the Claude GitHub App requires it. Without it, runs fail with OIDC authentication errors.actions: readlets Claude read CI results on pull requests.- The
if:line stops a runner starting for every comment. The repository’s fuller example also listens for new or assigned issues and submitted reviews, and the action answers@claudein the title or body of a newly opened issue too. - On a subscription, replace the last line with
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}.
Then comment something like @claude fix the TypeError in the user dashboard component. Claude answers in one comment that it updates as it works. On an open pull request it pushes commits to the pull request’s branch (for a fork’s pull request, to a pr-N branch in your repository); from an issue, or a closed pull request, it pushes a new branch (prefixed claude/) and leaves a link that opens a pre-filled pull request. Per the action’s FAQ, it does not open the pull request itself, and it does not rebase, merge or force-push. The phrase must be @claude as a whole word; trigger_phrase changes it, and label_trigger or assignee_trigger start it from a label or an assignee instead.
Runs without a mention: prompt and claude_args
Give the action a prompt and it runs on the workflow’s own events instead of waiting for @claude, with its output in the run log unless the prompt tells it to post and it has a tool that can. The prompt can be plain text, /skill-name for a skill in the repository’s .claude/skills/ (check the repository out first), or a plugin’s skill installed with the plugin_marketplaces and plugins inputs. Anthropic’s scheduled example, with a job timeout and a turn limit added:
name: Daily Report
on:
schedule:
- cron: "0 9 * * *"
jobs:
report:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
issues: read
id-token: write
steps:
- uses: anthropics/claude-code-action@v1
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
prompt: "Generate a summary of yesterday's commits and open issues"
claude_args: |
--model claude-opus-5-5
--max-turns 10
--allowedTools "mcp__github__list_commits,mcp__github__list_issues"Copiedclaude_args takes any Claude Code CLI flag: --model (without it, Claude Code’s default model), --max-turns, --allowedTools, --mcp-config, --append-system-prompt, --json-schema (the result then comes back in the structured_output output) and --permission-mode. GitHub runs scheduled workflows only from the default branch, and in a public repository turns the schedule off after 60 days without activity.
What Claude may run in these jobs is described two ways. Anthropic’s page says that for a plain-text prompt “Claude has no shell or GitHub API access until you grant the tools the prompt needs”. The action’s own usage guide at v1.0.287 says “The action runs Claude in auto mode by default”: reads and edits in the checkout go ahead, and a safety review decides other tool calls your allow rules do not cover, while broad allow rules are ignored. Its security notes add that the review “catches many unsafe actions, but a call can still run if the review passes it.” If your workflow relies on --allowedTools as a strict list, the guide’s answer is to set the mode yourself: --permission-mode default for prompt workflows, --permission-mode acceptEdits for @claude ones. How those modes behave elsewhere is in running Claude Code without permission prompts.
The inputs you are most likely to set
| Input | Default | What it does |
|---|---|---|
prompt | empty | Instructions or a skill; empty means wait for the trigger phrase |
claude_args | empty | Claude Code CLI flags |
anthropic_api_key, claude_code_oauth_token | none | The credential, from a secret |
github_token | none | Your own GitHub token; without it the action acts as the Claude GitHub App |
trigger_phrase | @claude | The phrase it answers to |
label_trigger, assignee_trigger | claude, none | Start from a label (with the labeled issue event) or an assignee |
allowed_bots, allowed_non_write_users | empty | Let named bots or users without write access trigger it |
allow_fork_prs | true | "false" skips pull requests from forks |
restrict_untrusted_prs | true | Blocks commands that run repository code on pull requests from authors without write access |
settings | empty | Claude Code settings as JSON or a file path |
use_bedrock, use_vertex, use_foundry | false | Send model calls to your cloud account |
show_full_output | false | Full JSON output in the log, which can include secrets |
The full list is the action’s action.yml. The action installs Claude Code on the runner itself; to use a build you installed, pass its path in path_to_claude_code_executable.
Signing in: API key, subscription token or no stored key
An API key from the Claude Console, in ANTHROPIC_API_KEY, bills each run as API usage. For a secret shared across an organization’s repositories, Anthropic recommends this over a subscription token. How to make a key and keep its spend in check is in the Claude Code API key guide.
A subscription token comes from running claude setup-token on your own machine. Per Anthropic’s authentication page it is a one-year token that needs a Pro, Max, Ultra, Team or Enterprise plan, can only make model requests, and is printed once and saved nowhere, so paste it straight into the CLAUDE_CODE_OAUTH_TOKEN secret. Runs then draw on that person’s plan and its usage limits, not API billing, which is why it suits one person’s repositories better than a team’s. If both an API key and the token reach Claude Code, the key wins. More on the token, and renewing it, in claude setup-token.
No stored key, through Anthropic. Workload identity federation swaps the job’s GitHub OIDC token for API access through a Claude Console service account. After creating the federation rule in the Console (the action’s setup guide has the steps), replace the key line with the rule’s IDs and keep id-token: write:
- uses: anthropics/claude-code-action@v1
with:
anthropic_federation_rule_id: ${{ secrets.ANTHROPIC_FEDERATION_RULE_ID }} # fdrl_...
anthropic_organization_id: ${{ secrets.ANTHROPIC_ORGANIZATION_ID }}
# optional: anthropic_service_account_id (svac_...), anthropic_workspace_id (wrkspc_...)CopiedNo stored key, through your cloud. With use_bedrock, use_vertex or use_foundry, model calls go to Amazon Bedrock, Google Cloud’s Agent Platform or Microsoft Foundry, and the job signs in to that cloud with its OIDC token. On AWS, per Anthropic’s cloud providers page, that means an OIDC identity provider for https://token.actions.githubusercontent.com with audience sts.amazonaws.com, and an IAM role that trusts it only for your repository (a subject such as repo:your-org/your-repo:*) and may invoke Claude models. Its ARN goes in an AWS_ROLE_TO_ASSUME secret. The page’s Bedrock workflow, in the form it gives for the official Claude GitHub App, trimmed to the comment events:
name: Claude PR Action
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
jobs:
claude-pr:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: us-west-2
- uses: anthropics/claude-code-action@v1
with:
use_bedrock: "true"
claude_args: '--model us.anthropic.claude-sonnet-4-6'CopiedThe Google Cloud and Foundry versions swap the AWS step for google-github-actions/auth@v2 or azure/login@v2. The page warns that on a public repository any user’s comment containing the trigger phrase starts this workflow, and the cloud sign-in runs before the action checks the commenter’s write access, so outsiders cannot use it but can leave entries in your cloud’s audit log and spend Actions minutes. A step that checks the commenter’s access before the credential steps avoids that.
The GitHub permissions involved
Two sets apply. The permissions: block in the workflow is what the job’s own token may do; keep it to what the job needs, as the examples above do (the scheduled report only reads). The Claude GitHub App, which the action acts as by default, has its own set. Anthropic says the action relies on three of its permissions, Contents, Issues and Pull requests, each read and write. The app is shared with Code Review and other Claude features, though, and installing it grants all of these, since “GitHub doesn’t let you accept a subset”:
- Read and write: Actions, Checks, Contents, Discussions, Issues, Pull requests, Repository creation, Repository hooks, Workflows.
- Read: Administration, Dependabot alerts, Members, Merge queues, Metadata, Statuses.
On workflow files the two Anthropic sources disagree: that table lists Workflows as read and write, while the action’s FAQ says “The GitHub App for Claude doesn’t have workflow write access for security reasons” and that Claude will not edit them. The action’s security notes reconcile part of it: they list Workflows (read and write) among the permissions the app requests for future features, not ones the action uses yet. If your organization wants only the three, Anthropic’s route is a custom GitHub App with Contents, Issues and Pull requests, its ID and private key kept as APP_ID and APP_PRIVATE_KEY secrets, and a token made from them with actions/create-github-app-token@v2 passed as github_token. A custom app covers the action only; Code Review still needs the official one. Passing the job’s own GITHUB_TOKEN instead works too, with a catch covered under the failures below. Install either app on selected repositories rather than all of them.
Who can make it run, and what it reads
Before Claude starts, the action checks the actor. On issue and pull request events the user must have write access to the repository, and a bot is refused unless it is in allowed_bots, which stops loops. A scheduled run skips the write check but not the bot check: GitHub attributes it to a repository user, usually whoever last changed the cron line, so if that was a bot, list it. allowed_non_write_users lets named users through, and the security notes call it a significant risk; it also needs your own github_token.
- Prompt injection. Claude reads the issue, the comments and the pull request, and on a public repository anyone can write those. The notes warn: “Beware of potential hidden markdown when tagging Claude on untrusted content.”
include_comments_by_actorandexclude_comments_by_actorlimit whose comments it sees. The general problem is in what prompt injection is. - Pull requests from outsiders. On a pull request whose author lacks write access, Claude’s configuration files come from the base branch, and “the action denies commands that commonly run repository code (package managers, test runners, interpreters and shells), even if
claude_argsallows them.” The notes add: “This is a list of common commands, not a sandbox.”allow_fork_prs: "false"skips fork pull requests altogether. GitHub does not pass secrets to runs triggered from a fork, such as apull_requestworkflow on a fork’s pull request, but a comment on that pull request runs in your repository, with your secrets. When an@clauderequest on a fork’s pull request makes Claude push, it pushes topr-Nin your repository, a branch that holds the fork’s commits and that GitHub’s limits on fork runs do not cover: “A workflow or other CI that builds it runs the contributor’s code and can have your secrets.” pull_request_targetandworkflow_run. These run with your secrets even for a fork’s pull request. The notes’ rule: “Do not check out an untrusted ref into the workspace root before this action.”- Secrets in logs. Never put a key in the workflow file; use
secrets.. Leaveshow_full_outputoff: its output can contain secrets, and on a public repository “These logs are publicly visible”. It also turns on by itself when theACTIONS_STEP_DEBUGsecret istrue. - Removing a secret does not revoke it. Anthropic’s uninstall steps note that a deleted secret’s credential stays valid; delete the key in the Console too.
What a run costs
Two meters run at once. The first is GitHub Actions. Per GitHub’s billing page (read November 23, 2026), standard GitHub-hosted runners are free in public repositories and self-hosted runners are free everywhere; in private repositories each plan includes a monthly amount of compute in dollars ($12 on Free, $18 on Pro and Team, $300 on Enterprise Cloud), and a standard 2-core Linux runner costs $0.006 a minute. By that arithmetic, Free’s allowance is 2,000 Linux minutes, and a ten-minute Claude job in a private repository uses six cents of it.
The second is the model. With an API key, every run is billed by the tokens it uses, which grow with the prompt, the task and how much of the repository Claude reads; the action’s usage guide adds that auto mode’s safety-review requests may count toward token usage. With a subscription token, runs come out of the plan’s usage limits instead. Current rates are in what Claude Code costs. The brakes Anthropic lists: specific @claude requests, issue templates that give context up front, a short CLAUDE.md (read on every run), --max-turns, a timeout-minutes on the job, and GitHub’s concurrency groups to stop parallel runs piling up.
When it does not work
- No reply to
@claude. Check that the app is installed on the repository, Actions are enabled, the secret exists under the name the workflow uses, the comment has@claudeas a whole word (not/claudeor@claude-bot), and the commenter has write access. A comment posted by another workflow asgithub-actionscannot start it, because that user cannot trigger workflows; use a personal or app token there. - OIDC authentication errors. Add
id-token: write; the default app sign-in needs it, and so do federation and the cloud providers. With a cloud provider, also check that the trust condition matches the repository exactly. 403 Resource not accessible by integration. GitHub App tokens cannot call GitHub’s/userendpoint; the FAQ’s fix is to setbot_idandbot_name.- Your CI does not run on Claude’s commits. GitHub’s rule is that “events triggered by the
GITHUB_TOKENwill not create a new workflow run”. If you passgithub_token: ${{ secrets.GITHUB_TOKEN }}, remove it so the action uses the Claude app, or pass a custom app’s token. - Authentication fails with a key or token. Test the same credential locally with
claudefirst. ACLAUDE_CODE_OAUTH_TOKENexpires a year after it was made. - Claude cannot see history. The examples check out with
fetch-depth: 1; raise it inactions/checkoutif the task needs older commits.
Still on @beta? Change the uses: line to @v1, delete the mode input (v1 chooses the mode from whether there is a prompt), rename direct_prompt to prompt, and move max_turns and model into claude_args; custom_instructions becomes --append-system-prompt. OpenAI’s equivalent for Codex, which takes only an API key, is in Codex and GitHub.