# Set up Claude Code GitHub Actions

Canonical: https://cwyn.com/pages/claude-code-guide-github-actions.html
Last updated: 2026-11-23T07:30:51-05:00

Claude Code setup guide

With admin access to a github.com repository, run `claude` in the repository and enter `/install-github-app`. For manual setup, install the Claude GitHub App, add an API key or subscription token as a repository secret, and save `claude.yml` in `.github/workflows/`. Once the workflow is merged, mention `@claude` in an issue or pull request comment and ask for a specific change.

Last updated November 23, 2026

By CWYN · Published Nov 23, 2026 · [Anthropic’s Claude Code GitHub Actions documentation](https://code.claude.com/docs/en/github-actions) (as of Nov 23, 2026)

## 1. Install the GitHub App from Claude Code

Both setup paths require repository admin access. The quick installer supports github.com remotes only. With a gitlab.com or bitbucket.org remote, it prints a notice and exits.

1. Sign in to the GitHub CLI with `gh auth login`. From the repository directory, start `claude` and enter `/install-github-app`.
2. Install the Claude GitHub App for the repository in your browser. Back in the installer, choose Set up GitHub Actions workflows.
3. Select the workflows you want. Keep @claude mentions to take requests in comments and PR review for automatic reviews. You can deselect either workflow.
4. Choose a long-lived Claude subscription token or a Claude Console API key and confirm. Create the pull request when Claude Code prompts you, check the workflow files, and merge it.

To test the mentions workflow, comment on an open pull request from an account with write access. Try `@claude Does the README still describe what this change does?` Look for Claude’s reply in the thread. You can also ask it to edit the README and push a commit.

The installer supports the Claude API and Claude subscriptions. For Bedrock, Agent Platform or Foundry, follow the provider-specific setup in Anthropic’s documentation. The corresponding action inputs are `use_bedrock`, `use_vertex` and `use_foundry`.

## 2. Set up the mentions workflow manually

1. Install the Claude GitHub App on the repository where Claude will work.
2. Add a repository Actions secret. For an API key from the Claude Console, name it `ANTHROPIC_API_KEY`. For a subscription, run `claude setup-token` locally and save the resulting token as `CLAUDE_CODE_OAUTH_TOKEN`.
3. Copy `examples/claude.yml` from `anthropics/claude-code-action` to `.github/workflows/claude.yml` in your repository. The minimal workflow below uses an API key and listens for new issue, PR conversation and inline review comments.

```
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 }}
```

The `if` condition keeps a runner from starting for comments without `@claude`. For subscription billing, replace the final line under `with` with the following line.

```
          claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
```

Merge the workflow, then try the README question above in a pull request comment. A reply confirms the event, credential and app permissions work together.

## 3. Choose an API key or a subscription token

GitHub Actions credentials as of Nov 23, 2026

| Setting | Claude Console API key | Claude subscription token |
| --- | --- | --- |
| Repository secret | `ANTHROPIC_API_KEY` | `CLAUDE_CODE_OAUTH_TOKEN` |
| Action input | `anthropic_api_key` | `claude_code_oauth_token` |
| Who pays for tokens? | Token usage is billed to the key’s Claude API account. | Runs use the token owner’s Claude subscription. |
| Organization use | Prefer a Console API key for a secret shared across the organization. | The OAuth token is tied to one person’s subscription. |

Pro, Max, Ultra, Team and Enterprise subscribers can generate a long-lived token with `claude setup-token`. Store the credential in GitHub secrets and commit only the reference to the secret.

## 4. Choose a mention or an automatic prompt

Interactive mode. Leave the `prompt` input unset. Claude waits for `@claude`, analyzes the code and replies with a comment. It can implement a requested change and push commits. The sample filters on the comment body. To take mentions in a submitted review or a new issue’s title or body, listen for that event and check the field that holds the text. If you change `trigger_phrase`, update the workflow’s comment filter to match.

Automation mode. Set `prompt` to a task you want to run on a GitHub event. Claude runs without a mention, and the result appears in the workflow run log by default. A plain-text prompt needs explicit tool access to run shell commands or use the GitHub API. Allow the tools it needs with `--allowedTools` in `claude_args` or `permissions.allow` in the `settings` input. To supply an MCP configuration, pass `--mcp-config` with its path in `claude_args`.

## 5. Post a review on a pull request

Select the PR review workflow during quick setup to get automatic feedback without typing `@claude`. For a workflow you maintain yourself, load `code-review@claude-plugins-official` through the `plugins` input. The `plugin_marketplaces` input lets a workflow specify its plugin sources.

In `prompt`, invoke `/code-review:code-review --comment` and identify the pull request to review. In `claude_args`, pass `--allowedTools "mcp__github_inline_comment__create_inline_comment"`. Claude posts findings inline or leaves one summary comment if it finds nothing. Omitting `--comment` keeps the review out of the PR conversation.

Claude skips draft and closed pull requests. In a public repository, GitHub withholds secrets from fork PR runs, so automatic reviews run only on branches in the same repository.

## 6. Estimate cost and limit each run

Each run uses GitHub Actions minutes on a GitHub-hosted runner and Claude tokens. The API key bills those tokens to your Claude API account. An OAuth token uses your Claude subscription. Choose the credential first so you know where to check usage.

- Ask a specific question, such as whether the README’s installation steps still match the change.
- Use an issue template to collect the affected files and the result you expect.
- Keep `CLAUDE.md` concise. Claude reads it on every run. Start with the [project CLAUDE.md template](https://cwyn.com/pages/claude-code-guide-claude-md-template.html).
- Cap the work Claude can do per run with `--max-turns 5` in `claude_args`. Adjust the cap to fit the task.
- Set a timeout on the Claude job in the workflow to bound how long the runner can stay busy.
- Use workflow concurrency controls to keep overlapping runs from reviewing the same change at the same time.

Check your account’s [Claude Code usage limits](https://cwyn.com/pages/claude-code-guide-usage-limits.html) or compare billing options in the [cost-per-month guide](https://cwyn.com/pages/claude-code-guide-cost-per-month.html). [Estimate your own](https://cwyn.com/score/ai-cost-calculator/).

## 7. Set permissions and restrict who can trigger a run

The action relies on three GitHub App permissions. Grant Contents, Issues and Pull requests read and write access. The official Claude GitHub App also requests permissions for other features, including Actions, Checks and Workflows. GitHub requires accepting its full set. Organizations that need only the three action permissions can create a custom GitHub App. The separate Code Review product falls outside that custom app’s scope.

The workflow job also declares its permissions. In the example, `id-token: write` is required for default GitHub App authentication, and `actions: read` lets Claude read CI results. Grant only the permissions and tools the job needs. For tool-level rules, see [how Claude Code permission allowlists work](https://cwyn.com/pages/claude-code-guide-permission-allowlist-prompts.html).

On issue and PR events, the person triggering the run needs write access. To make an exception, supply your own `github_token` and list the account in `allowed_non_write_users`. Bot actors must be listed in `allowed_bots`. Keep keys and tokens in GitHub secrets, and review Claude’s changes before merging them.

## 8. Troubleshoot a missing reply, CI run or review

### Claude does not reply to a mention

Check that the app is installed on this repository, Actions workflows are enabled, and the mentions workflow has been merged. Verify the secret name against the workflow input. Comment from an account with write access and use `@claude` as a whole word. Neither `/claude` nor `@claude-bot` is the default trigger.

### CI does not run on Claude’s commits

Commits made with the default `GITHUB_TOKEN` do not trigger workflows. Remove `github_token: ${{ secrets.GITHUB_TOKEN }}` from the action inputs so the action authenticates as the app. Check that your CI workflow listens for `push` or `pull_request`.

### The action reports an authentication error

Test the key or token locally with `claude` first. Once it works there, check that the repository secret contains that credential and the action uses the matching input from the table.

### A review ran but no comment appeared

Open the workflow run log. Check the review command for `--comment` and confirm that `claude_args` allows the inline comment tool. If the review never ran, check whether the PR is a draft, is closed or comes from a fork of a public repository.

## 9. Claude Code GitHub Actions FAQ

### Does the GitHub Action work with a Claude Max plan?

Yes. Run `claude setup-token` locally and store the token as `CLAUDE_CODE_OAUTH_TOKEN`. Pass that secret to `claude_code_oauth_token` to use your Max subscription for the run.

### Can a workflow run Claude Code on a schedule?

Yes. Use a cron entry under `on: schedule` and supply a `prompt`. GitHub runs scheduled workflows from the default branch. In public repositories it disables schedules after 60 days without activity.

### Which model does the action use?

The action uses the Claude Code default model. To select one for a workflow, pass `--model` and the model name in `claude_args`.

### What changes when I upgrade a beta workflow?

Change `anthropics/claude-code-action@beta` to `@v1` on the same action and remove `mode`. Rename `direct_prompt` to `prompt`. Move `max_turns` and `model` into `claude_args` as `--max-turns` and `--model`. Pass former `custom_instructions` with `--append-system-prompt`.

## Next steps

- [All 34 Claude Code guides](https://cwyn.com/guides/claude-code/)
- [Claude Code setup walkthrough](https://cwyn.com/setup/claude-code/)
- [Free AI cost calculator](https://cwyn.com/score/ai-cost-calculator/?tool=claude)
- [Claude Code Complete Setup Pack ($12.95)](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html)

## Email me the CLAUDE.md + settings starter

Get the editable CLAUDE.md template and a project setting you can merge into .claude/settings.json.

Email address

Email me this file. Also send up to 4 short follow-up emails with tips and one related CWYN product. Unsubscribe any time. [Privacy policy](https://cwyn.com/pages/privacy.html)

### Set project instructions and permission rules

For a starter `CLAUDE.md` and permission presets you can adapt to your repository, see the [Claude Code Complete Setup Pack ($12.95)](https://cwyn.com/pages/pack-claude-code-complete-setup-pack.html).
Kit details as of Nov 22, 2026

Claude Code Complete Setup Pack $12.95

Set up project instructions, permission rules, hooks, a reviewer skill and subagent, and MCP connections for Claude Code.
