Free generator

Claude Code GitHub Action Generator

Generate a workflow for anthropics/claude-code-action: let your team ask @claude on issues and PRs, review every pull request automatically, run a custom check, or schedule a daily job.

Add ANTHROPIC_API_KEY under Settings → Secrets → Actions.

Caps how long a run can go on.

Comma-separated, e.g. Bash(npm test *), mcp__github__create_issue. In automation mode Claude has no shell access until you allow it.

.github/workflows/claude.yml
name: Claude Code
on:
  issue_comment:
    types: [created]
  pull_request_review_comment:
    types: [created]
  pull_request_review:
    types: [submitted]
  issues:
    types: [opened, assigned]

concurrency:
  group: claude-${{ github.event.issue.number || github.event.pull_request.number }}
  cancel-in-progress: true

jobs:
  claude:
    if: |
      (github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
      (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
      (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
    runs-on: ubuntu-latest
    timeout-minutes: 30
    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 }}
Commit to your default branch. For the @claude workflow, also install the Claude GitHub App, or run /install-github-app in Claude Code to set it all up.

Interactive or automation mode

Without a prompt input, the action waits for the trigger phrase and replies in a comment. With a prompt, it runs on every matching event and writes to the workflow log unless it has a tool that can post. Claude has no shell in automation mode until you allow tools; test the rules with the permission rule tester, and see every flag you can pass in claude_args in the CLI reference.

Claude reads your CLAUDE.md on every run, so a good one improves every review. Write one with the CLAUDE.md generator.

Frequently asked questions

How do I set up the Claude Code GitHub Action?

The quickest way is to run /install-github-app inside Claude Code, which installs the Claude GitHub App and adds the secret and workflow for you. To do it by hand, install the app, add an ANTHROPIC_API_KEY repository secret, and commit a workflow like the one generated above.

Can I use my Claude Pro or Max subscription instead of an API key?

Yes. Run claude setup-token on your machine to create an OAuth token, save it as a repository secret named CLAUDE_CODE_OAUTH_TOKEN, and pick "Claude subscription" above so the workflow passes claude_code_oauth_token instead of anthropic_api_key.

How do I get Claude to review every pull request?

Choose "Review every PR". The workflow runs on pull_request events and uses Anthropic's code-review plugin, which posts inline comments on the problems it finds.

How much does the Claude GitHub Action cost?

You pay for GitHub Actions minutes on the runner and for the Claude tokens each run uses. Keep runs cheap with --max-turns, a job timeout, a focused CLAUDE.md, and a cheaper model for routine checks. Estimate token costs with the API cost calculator.

Why does Claude not reply to my comment?

Check the comment contains the trigger phrase, the commenter has write access to the repo (bots are rejected unless listed in allowed_bots), the workflow file is on the default branch, and the secret name matches.

Sources: Claude Code GitHub Actions docs, claude-code-action. Claude Code Agents is an independent site, not affiliated with Anthropic.

More free Claude Code tools

All tools →