Originally published on DevToolHub.
Claude Code GitHub Actions sits behind three layers of permission: the GitHub App you install, the permissions block in your workflow, and the rules about who can trigger a run. The first layer is the surprise. The official app asks for 15 permissions, GitHub does not let you accept a subset, and the action itself uses only three of them.
I did not run this end to end. I read the official docs and the action's security notes, linted the example workflows, and checked the pinned versions below. Treat the YAML as a checked starting point, not a field report.
In this guide:
- See every permission the Claude GitHub App requests and which ones the action uses
- Pick between an API key, a subscription token and OIDC federation
- Learn how fork pull requests and outside contributors are handled
- Copy two locked-down workflows pinned to commit SHAs
What permissions does the Claude Code GitHub Actions app request?
The official Claude GitHub App requests 15 permissions when you install it. The action relies on three: Contents, Issues and Pull requests, all read and write. The rest serve other Claude features, such as Code Review. GitHub applies one permission set per app, so you cannot accept only part of it.
| Permission | Access |
|---|---|
| Contents, Issues, Pull requests | Read and write (the three the action uses) |
| Actions, Checks, Discussions | Read and write |
| Workflows, Repository hooks | Read and write |
| Repository creation | Read and write |
| Administration | Read |
| Dependabot alerts, Members, Merge queues, Metadata, Statuses | Read |
Note: The two official pages disagree. The docs page lists the 15 permissions above and says the set can change ahead of the features that use it. The security notes in the action's repository list only seven and call some of them "for future features", with Actions and Checks as read only. I read both on November 20, 2026. Trust the docs page for what you grant, and re-read it before you install.
If 15 is too many for your organization, the docs offer one alternative. Create a custom GitHub App with only Contents, Issues and Pull requests. A custom app covers the action only. Code Review and web auto-fix still need the official app.
Which secret should you use: API key, token or OIDC?
Use an API key for anything shared across repositories. The action accepts ANTHROPIC_API_KEY, a subscription token called CLAUDE_CODE_OAUTH_TOKEN, or OIDC federation. The token comes from claude setup-token on Pro, Max, Ultra, Team and Enterprise plans. It is tied to the subscription of the person who ran the command.
That last detail matters for teams. If the person leaves or the plan changes, the shared secret breaks. The docs recommend an API key from the Console for organization-wide secrets.
To avoid a long-lived secret entirely, use workload identity federation. The action exchanges the workflow's GitHub OIDC token for API access through a Console service account. You set anthropic_federation_rule_id and anthropic_organization_id, and the job needs id-token: write.
Warning: Never paste a key into a workflow file. Store it as a GitHub secret and reference
${{ secrets.ANTHROPIC_API_KEY }}. The action's security notes also keepshow_full_outputoff by default, because it prints tool output and file contents. Debug mode turns it on automatically, and the logs of a public repository are public.
What do the workflow permissions do?
Each line in the permissions block maps to one capability. contents: write lets Claude push branches, pull-requests: write and issues: write let it comment, and actions: read lets it read CI results. id-token: write is required for the default GitHub App authentication, even if you never use OIDC federation.
A review-only workflow needs less. Set contents: read and keep write access to pull requests so Claude can post comments. Set permissions: {} at the top of the file, then grant each job only what it needs.
One more default helps you. Claude does not open pull requests on its own when you mention it. It pushes a branch and gives you a link to the pull request page, so a human still clicks the button.
Who can trigger Claude Code GitHub Actions?
Only users with write access to the repository can trigger a run. The action checks this on issue, pull request, comment and review events. Bots are rejected unless you list them in allowed_bots, which keeps bots from triggering Claude in a loop.
Two settings weaken this check, so use them with care:
-
allowed_bots: '*'is not checked against repository permissions. On a public repository, any GitHub App can open an issue or comment and hand Claude a prompt it controls. List specific names instead. -
allowed_non_write_usersbypasses the write check. The docs call it risky and say to use it only with extremely limited permissions, and to passgithub_token: ${{ secrets.GITHUB_TOKEN }}, never a personal access token.
How does Claude Code GitHub Actions treat fork pull requests?
Recent releases of the action skip fork pull requests by default. The change landed after v1.0.284, and a workflow on a floating tag such as @v1 picked it up with no edit on your side. Setting allow_fork_prs: "true" turns fork runs back on. When the action skips a fork, it checks out nothing and does not start Claude. The step still succeeds, so a required check that only runs the action will pass without a review. The workflows below set allow_fork_prs: "false" so the behavior is explicit and does not depend on the version.
For pull requests from authors without write access, restrict_untrusted_prs is on by default. It does two things:
- It denies commands that commonly run repository code, such as package managers, test runners, interpreters and shells.
- It restores Claude's configuration from the base branch before the run:
.claude/,.mcp.json,CLAUDE.md,AGENTS.md,.husky/and a few more. These are the same instruction files I tested in CLAUDE.md vs AGENTS.md.
The docs say plainly that the command list is "a list of common commands, not a sandbox". A rule like Bash(./scripts/test.sh) stays allowed.
If you turn fork runs on, there is one more trap. On an open fork pull request, Claude pushes to a pr-N branch in your repository. That branch holds the fork's commits too, and GitHub's limits on fork runs do not apply to it. Keep pr-* out of any CI that holds secrets, for example with branches-ignore: ["pr-*"] on push triggers. Never deploy from it.
Warning: If you use
pull_request_targetorworkflow_run, do not check out the pull request head into the workspace root before the action. Those events run with your repository's secrets. Check out the base ref instead, and put the head in a subdirectory.
A locked-down Claude Code GitHub Actions workflow
These two workflows pin the action and actions/checkout to commit SHAs, skip forks, cap turns and time, and grant the least each job needs. The docs' own examples use @v1. The docs also say workflows on a floating tag get new behavior without any change on your side. A SHA stops that. The SHAs below are v1.0.289 of the action and v7.0.1 of checkout.
The first answers @claude mentions. The second reviews pull requests and cannot push:
name: Claude mentions
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
permissions: {}
concurrency:
group: claude-${{ github.event.issue.number || github.event.pull_request.number }}
cancel-in-progress: false
jobs:
claude:
if: contains(github.event.comment.body, '@claude')
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
pull-requests: write
issues: write
id-token: write
actions: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@eb56b6666facdbd501035f4a0269d8caee2e7a8b # v1.0.289
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
allow_fork_prs: "false"
claude_args: --max-turns 8
name: Claude review (read-only)
on:
pull_request:
types: [opened, synchronize, ready_for_review]
permissions: {}
jobs:
review:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
pull-requests: write
issues: read
id-token: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 1
- uses: anthropics/claude-code-action@eb56b6666facdbd501035f4a0269d8caee2e7a8b # v1.0.289
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
allow_fork_prs: "false"
prompt: "Review this pull request for bugs and security problems. Comment only."
claude_args: >-
--max-turns 6
--disallowedTools "Bash(git push:*)"
--allowedTools "mcp__github_inline_comment__create_inline_comment"
The --disallowedTools "Bash(git push:*)" rule also blocks the action's own push scripts, because the docs say a deny rule in claude_args covers them. Pass it in claude_args. A rule in a settings file does not count.
Tip: Pair the workflow with branch protection on your default branch and a CODEOWNERS file. The docs note that a workflow can allow other push commands, so protection is your backstop. For more on pinning and supply-chain habits, see the Git and GitHub Actions guide and the lockfiles guide.
What else breaks in Claude Code GitHub Actions?
Three smaller things catch people.
-
CI does not run on Claude's commits. GitHub does not trigger workflows for commits made with the default
GITHUB_TOKEN. The docs say to remove agithub_tokeninput so the action authenticates as the GitHub App. -
Commits are unsigned by default. Set
use_commit_signing: truefor API-signed commits, orssh_signing_keyif you also need rebases and cherry-picks. -
Auto mode is a review, not a boundary. The security notes say a call can still run if the review passes it. For a strict allow list, use
--permission-mode acceptEditsordefault.
Prompt injection is the other risk. The action strips HTML comments, invisible characters and hidden attributes from input. The docs still say new bypasses may appear, and they recommend reading the raw text of anything from an outside contributor before you tag Claude on it.
What I did not test
I never ran these workflows. I did not install the GitHub App, add a secret or trigger a run, so I cannot confirm the behavior described in the docs, such as the denied commands on fork pull requests or the pr-N branch. Here is what I checked on November 20, 2026, and re-checked on November 24 after a new release:
-
actionlint1.7.12 passes both workflows and the docs' three example workflows, with exit code 0. - Both pinned SHAs exist, and every input I used exists in
action.ymlat the pinned action SHA. - The docs page and the security notes were fetched and read in full.
Docs and defaults change quickly here. The action had shipped several releases the day before I checked, and one of them changed the fork default.
Frequently Asked Questions
Q: What permissions does the Claude GitHub App need?
A: Installing the official app grants a fixed set of 15 permissions. The action itself relies on Contents, Issues and Pull requests. GitHub does not allow accepting a subset, so use a custom app if you want only those three.
Q: Is it safe to run Claude Code in GitHub Actions on a public repository?
A: It can be, with limits. Runs need write access by default, bots are blocked, and fork pull requests are skipped by default in recent releases, and allow_fork_prs: "false" makes that explicit. Avoid allowed_bots: '*' and keep workflow permissions minimal.
Q: Should I use an API key or an OAuth token?
A: Use an API key for shared or organization-wide secrets. The OAuth token from claude setup-token belongs to one person's subscription. OIDC federation avoids a stored secret entirely.
Q: Why does CI not run on the commits Claude makes?
A: GitHub does not start workflows for commits pushed with the default GITHUB_TOKEN. Remove the github_token input so the action uses the GitHub App identity instead.
Quick Summary:
- The official Claude GitHub App requests 15 permissions as one fixed set, and the action uses three
- The docs page and the action's security notes disagree on that list, so re-read the docs before installing
- Use an API key for shared secrets, since the OAuth token is tied to one person's subscription
- Only write-access users trigger runs, bots are blocked by default, and
allowed_bots: '*'is risky on public repositories - Set
allow_fork_prs: "false"explicitly, since recent releases skip forks by default, keeppr-*branches out of CI with secrets if you enable forks, and pin the action to a commit SHA - The workflows here pass
actionlintand use real pinned SHAs, but I did not run them
For Claude Code GitHub Actions, grant the least at every layer: app, workflow and trigger. Then pin the action and protect your default branch.
Top comments (0)