Skip to content

Day 23 of 52 · about 25 min · Automation

Add Claude to your GitHub pull requests

A review or a small fix can start from a comment on a pull request, so teammates who never open a terminal can still ask Claude. Setting it up takes one command and one merge.

You’ll finish with

  • The Claude GitHub App and its secret on your repository
  • A merged workflow that answers @claude in comments
  • A reply from Claude on a real pull request

You’ll need

  • A GitHub repository you administer, holding the Day 23 kit or your own code. Each run uses its GitHub Actions minutes.
  • The GitHub CLI, signed in with gh auth login
  • A Claude API key, or a Pro, Max, Team or Enterprise plan for a subscription token (GitHub Actions docs)

Before you start

Tell us about your setup and the steps change to fit it. Your answers stay in this browser, and you can change them at any time.

Which system are you on?

Commands differ between systems. Pick the one you’ll run Claude Code on.

The steps

One step at a time. When a step’s check matches, tick it and the next one opens.

0 of 3 steps done0%
  1. Step 1 of 3: Run /install-github-app

    Let Claude Code install the GitHub App, save the secret and prepare the workflow.

    Start claude in your local clone of the repository and run /install-github-app. Follow the prompts, choosing an API key or a subscription token.

    Note: The kit already holds .github/workflows/claude.yml, copied from the docs. If the command offers Update workflow file with latest version, pick it.

    In order:

    1. Claude

      Install the GitHub App

    2. Claude

      Save the secret

      ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN

    3. Claude

      Push a workflow branch

    4. You

      Create the pull request

    One command does the setup. You create and merge the pull request.

    Check it worked

    GitHub opens in your browser with a pull request ready to create.

    If it didn’t work

    The command fails, or your remote isn’t on github.com

    It works only with github.com. Set up by hand: install the Claude GitHub App, add the secret, and keep the kit’s claude.yml. On GitLab, see GitLab CI/CD.

  2. Step 2 of 3: Create and merge the workflow pull request

    Mentions start working once the workflow is merged.

    Create the pull request, then merge it. The workflow runs when a new comment or review comment contains @claude.

    .github/workflows/claude.ymlYAML
    # Day 23: Claude replies when someone mentions @claude in an issue or
    # pull request comment.
    # Copied from https://code.claude.com/docs/en/github-actions on 9 October 2026
    # ("Respond to @claude mentions"). Only these comment lines are ours.
    #
    # Using a Claude subscription instead of an API key? Replace the
    # anthropic_api_key line at the bottom with:
    #   claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
    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 }}
    

    With a subscription token, swap the last line as the comment at the top says.

    your-repo/

    • folder .github
      • folder workflows
        • claude.ymlNewanswers @claude in comments
    After the merge, the workflow sits on your default branch.

    Check it worked

    .github/workflows/claude.yml shows on your default branch on GitHub.

  3. Step 3 of 3: Mention @claude on a pull request

    Open a small pull request and ask Claude something in a comment.

    Open any small pull request, such as a one-line README edit. Then comment:

    Pull request comment
    @claude review this change and tell me if anything could break the tests

    In order:

    1. You

      You comment

      @claude plus a request

    2. Tool

      The workflow starts

      on a GitHub-hosted runner

    3. Claude

      Claude replies

      in a comment it updates as it works

    Claude only answers people with write access to the repository. Anyone else’s run fails.

    Check it worked

    A run appears in the repository’s Actions tab, and Claude replies in a comment on the same pull request.

    If it didn’t work

    Nothing happens after your comment

    Check that the workflow is merged, the secret exists and the comment contains @claude.

Finish · 3 of 3 steps to go

Claude answers on your pull requests

Anyone with write access can now ask Claude from a comment. To remove it, delete the workflow and the secret.

What you’ll have checked

  • claude.yml is merged
  • A comment with @claude gets a reply on the pull request

Lesson updates by email

Get lesson updates by email

Leave your email and we’ll tell you when we add or update a lesson.

We’ll email you when we add or update a lesson. We use your email only for this. Privacy policy

Claude Code for your team

Want Claude Code set up across your team?

HorizonLux sets up and repairs Claude Code for teams: CLAUDE.md rules, hooks that enforce them and reviewed MCP servers. Book a free call to talk it through.

Questions

Questions about Day 23

What does each run cost?

GitHub Actions minutes, plus API tokens, or your plan’s usage with a subscription token. Add `--max-turns` to `claude_args` in the workflow to cap a run.

Sources

Checked against the official Claude Code docs on .

Independent resource, not affiliated with Anthropic. HorizonLux wrote this lesson; Claude Code is made by Anthropic.