Guide Agent Setup

Claude Code GitHub Actions: Set Up @claude on Issues and PRs

Install the app, add one secret, commit one workflow, then tag the agent where the work already is.

Last checked against the sources on November 16, 2026

What Claude Code GitHub Actions does

Claude Code GitHub Actions is Anthropic's anthropics/claude-code-action: a GitHub Action that runs Claude Code inside your repository's own workflows. Someone with write access mentions @claude in an issue or pull request comment, a runner starts, and Claude reads the thread and the code, answers in a comment, and pushes commits to a branch when the request calls for a change.

It is the GitHub-native version of tagging an agent in chat: the request, the agent's progress comment and the resulting branch all live on the issue or PR the team is already looking at. OpenAI's agent has a hosted version of the same flow; see our guide to the Codex GitHub integration.

What it means
Runs onGitHub Actions runners, using your Actions minutes
Triggered by@claude in a comment, review or new issue (interactive mode), or any GitHub event when the workflow sets a prompt (automation mode)
Authenticates withA Claude API key (ANTHROPIC_API_KEY), a Claude subscription token (CLAUDE_CODE_OAUTH_TOKEN), workload identity federation, or Amazon Bedrock, Google Cloud or Microsoft Foundry
Acts on GitHub asThe Claude GitHub App, with a short-lived token scoped to the one repository
Opens pull requestsNot by default: it pushes a branch and replies with a link to create the PR, so a person opens it

Before you start

  • Admin access to the repository. Both setup paths need it.
  • A repository on github.com. The /install-github-app command does not set up GitLab or Bitbucket repositories, and self-hosted GitHub Enterprise Server has its own setup in Anthropic's docs.
  • A way to pay for the model: a Claude API key from the Claude Console, or a Claude subscription that can generate a long-lived token with claude setup-token. Which plans include that is listed in Anthropic's authentication docs.
  • GitHub Actions enabled for the repository, with minutes to spend.
  • For quick setup only: Claude Code installed locally and the GitHub CLI signed in with gh auth login.

Quick setup with /install-github-app

If you already use Claude Code in a terminal, this is the shortest path. It does the three manual steps below for you and ends with a pull request you merge.

  1. Open claude in a local clone of the repository and run /install-github-app.
  2. Approve the Claude GitHub App install when the browser opens. You can stop here with Skip for now and finish later by running the command again.
  3. Pick a credential. Claude Code reuses an API key it already has, or offers to create a subscription token, and saves it as the repository secret ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN.
  4. Choose the workflows you want: the @claude responder (claude.yml) and, optionally, an automatic review workflow (claude-code-review.yml).
  5. Claude Code pushes a branch with those files and opens GitHub with a pull request ready to create. Create it, merge it, and @claude works in the repository.

Running /install-github-app again on a repository that already has claude.yml offers to update the workflow files to the latest version, through a new pull request.

Manual setup in three steps

Use this path when you don't run Claude Code locally, when the quick setup fails, or when you want to review every line that lands in .github/workflows/.

  1. Install the Claude GitHub App from github.com/apps/claude on the repository (or on the organization, for all or selected repositories).
  2. Add one Actions secret under Settings → Secrets and variables → Actions: ANTHROPIC_API_KEY for an API key, or CLAUDE_CODE_OAUTH_TOKEN for a subscription token.
  3. Commit a workflow file such as .github/workflows/claude.yml. The one below is the minimal responder from Anthropic's docs.
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 }}

If you stored a subscription token instead, replace the last line with claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}. The id-token: write permission is what the action's default GitHub App authentication needs; actions: read lets Claude see CI results on a pull request. The fuller examples/claude.yml in the action's repository also listens for new issues and submitted reviews that mention @claude.

Tagging @claude: what to write and what comes back

Once the workflow is on the default branch, a mention in an issue or PR comment is the whole interface:

@claude implement this feature based on the issue description
@claude how should I implement user authentication for this endpoint?
@claude fix the TypeError in the user dashboard component
  • Claude replies in a comment on the same thread and keeps updating it as it works.
  • For a change, it commits to a new branch (or to the pull request's own branch) and gives you a link to open the PR. It does not open the pull request itself in the default setup.
  • The mention has to be @claude as a whole word. /claude or @claude-bot won't trigger it unless you change trigger_phrase.
  • Specific requests finish in fewer turns. Put acceptance criteria in the issue, and keep project rules in a short CLAUDE.md at the repository root, which Claude reads on every run.

Interactive mode and automation mode

The action picks its mode from the workflow, with no mode setting:

  • Interactive mode: no prompt input. Claude waits for the trigger phrase in a comment, a review, or the title or body of a new issue, and answers on the thread.
  • Automation mode: the workflow sets prompt, so Claude runs on whatever event starts the workflow (a pull request opening, a label, a cron schedule) with no mention needed. Results go to the workflow run log unless the prompt tells Claude to post and it has a tool that can.

In automation mode Claude has no shell or GitHub API access until you grant the tools a plain-text prompt needs with --allowedTools in claude_args. Scheduled workflows run only from the default branch.

Who can trigger a run

Two checks run on the triggering actor before Claude starts, and the run fails if either rejects it:

  • Write access: on issue and pull request events, the person must have write access to the repository. allowed_non_write_users relaxes this, and the action's own security docs call that risky and meant only for workflows with very limited permissions.
  • Human actor: bots and GitHub Apps can't trigger runs unless listed in allowed_bots, which keeps two agents from setting each other off in a loop. Prefer named bots over '*', especially on public repositories.

On pull requests from authors without write access, the action also denies common commands that run repository code (package managers, test runners, shells) by default, and restores Claude's configuration files such as .claude/ and CLAUDE.md from the base branch.

Locking it down

  • Know what the app can do. The official Claude GitHub App is shared by every Claude feature on GitHub and asks for one broad permission set, which GitHub doesn't let you accept in part. The action itself uses Contents, Issues and Pull requests. If your policy allows only those, create a custom GitHub App with just them, following the action's setup guide; Code Review and web auto-fix still need the official app. Our piece on GitHub App permission scopes for coding agents covers how to weigh each scope.
  • Keep the job's permissions: block to what the workflow needs. A review-only workflow can run with contents: read and pull-requests: read.
  • Protect the default branch. Claude's push wrapper can't update other branches, but a workflow can allow other push commands. See least-privilege branch protection rules for agent commits.
  • Treat outside contributors' text as untrusted. The action strips HTML comments, invisible characters and hidden attributes, but review raw content before tagging Claude on it, and use include_comments_by_actor on public repositories.
  • Never put a key in the workflow file. Reference it as ${{ secrets.ANTHROPIC_API_KEY }}, and leave show_full_output off on public repositories, since full output can print secrets into public logs.
  • Cap each run: --max-turns in claude_args, a timeout-minutes on the job, and a concurrency group so a burst of mentions doesn't start a burst of runners.
  • Avoid checking out an untrusted pull request head before the action in pull_request_target or workflow_run workflows, which run with the base repository's secrets.

For a whole organization, install the app once at organization level, store the credential as an organization Actions secret (an API key rather than one person's subscription token), and add the workflow to each repository or call it as a reusable workflow. Workload identity federation removes the stored secret altogether.

When @claude doesn't respond

SymptomCheck
No run startsThe workflow file is on the default branch, Actions are enabled, and the comment contains @claude as a whole word
Run starts, then fails at onceThe commenter has write access, the actor isn't a bot missing from allowed_bots, and the secret name matches the input (anthropic_api_key or claude_code_oauth_token)
Authentication errorsTest the key or token locally with claude before debugging the workflow
CI doesn't run on Claude's commitsRemove github_token: ${{ secrets.GITHUB_TOKEN }} so the action pushes as the Claude GitHub App; GitHub doesn't trigger workflows on pushes made with the default GITHUB_TOKEN
Still on @betaSwitch to @v1, drop mode, rename direct_prompt to prompt, and move max_turns and model into claude_args

What it costs

Each run spends two things: GitHub Actions minutes on the runner, and model usage. Model usage is billed per token on an API key, or counts against your Claude subscription when you authenticate with an OAuth token. Prices change, so check GitHub's Actions billing documentation for minutes and Anthropic's pricing page for token rates rather than relying on a figure copied into a guide.

Sources

  1. Claude Code GitHub Actions - Claude Code Docs
  2. anthropics/claude-code-action on GitHub
  3. examples/claude.yml - claude-code-action
  4. Security - claude-code-action docs
  5. About billing for GitHub Actions - GitHub Docs

← All guides