Skip to content
RunAPI Developer Docs
Developer Resources
Developer Resources

Claude Code GitHub Actions

Configure Claude Code GitHub Actions with a RunAPI secret, model, permissions, triggers, and a minimal workflow.

Overview

The official anthropics/claude-code-action runs Claude Code in a GitHub Actions workflow. This guide stores a RunAPI key as a GitHub Secret, sets the non-sensitive Base URL in Claude Code settings, selects a model, and responds to authorized @claude comments.

Before you begin

  • You need repository administrator access to install the Claude GitHub App, create Actions secrets, and add a workflow.
  • Create a standard RunAPI API key in the Authentication Guide.
  • Copy a model identifier that supports Anthropic Messages from the Model Catalog.
  • Review the Claude Code GitHub Actions setup and your organization’s workflow policy.

Install

From Claude Code in the target repository, run /install-github-app and follow the prompts to install the GitHub App. When it offers to create an Anthropic credential, stop before saving one: this guide uses a RunAPI repository or organization secret instead.

For manual setup, install the Claude GitHub App, then add the workflow below to .github/workflows/claude.yml.

Configure RunAPI

Create a repository or organization Actions secret named RUNAPI_API_KEY. Pass it only through the action’s secret input:

YAML
anthropic_api_key: ${{ secrets.RUNAPI_API_KEY }}

Do not put the key in the workflow file or the action’s settings JSON. The action processes settings separately; only the non-sensitive Base URL belongs there.

The following minimal interactive workflow listens for new issue and pull request review comments:

YAML
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.RUNAPI_API_KEY }}
          settings: |
            {
              "env": {
                "ANTHROPIC_BASE_URL": "https://runapi.ai"
              }
            }
          claude_args: "--model YOUR_RUNAPI_MODEL_ID"

Secrets

GitHub does not pass ordinary Actions secrets to workflows triggered from fork pull requests or Dependabot events. If a run has no credential, confirm the event source before rotating the RunAPI key. Use GitHub’s Actions secrets guide for repository and organization scope.

Permissions

  • contents: write lets the action commit code changes.
  • pull-requests: write and issues: write let it read and reply to the triggering conversation.
  • id-token: write supports the action’s default GitHub App authentication.
  • actions: read lets it inspect workflow results.

Use these explicit permissions instead of write-all. Remove capabilities your workflow does not need.

Trigger events

issue_comment covers comments in issues and pull request conversations; pull_request_review_comment covers comments on diff lines. The workflow file must exist on the default branch before issue_comment can trigger it. The action also checks who initiated the run; use the official security behavior as the canonical reference.

Choose a model

Replace YOUR_RUNAPI_MODEL_ID in claude_args with the exact identifier from the Model Catalog. Keeping model selection outside settings.env makes the workflow’s chosen model visible in the action configuration.

Verify

  1. Confirm the RUNAPI_API_KEY secret exists without printing its value.
  2. Merge the workflow into the default branch and confirm Actions are enabled.
  3. From an account with repository write access, add @claude describe this repository in one sentence to an issue comment.
  4. Open the workflow run, confirm the action succeeds, and verify that Claude replies in the same issue.

Troubleshoot

  • No workflow starts: confirm the file is on the default branch, the comment event matches, and Actions are enabled.
  • The job is skipped: confirm the comment contains @claude and the actor has the required repository access.
  • Authentication fails: confirm the workflow references secrets.RUNAPI_API_KEY, then rotate the key through the Authentication Guide if needed.
  • A fork pull request cannot use the key: GitHub intentionally withholds ordinary secrets from fork-triggered runs. Do not replace the secret with a literal.
  • The model is unavailable: copy the exact identifier from the Model Catalog.
  • Claude commits do not start another workflow: review the official action’s GitHub token troubleshooting.

Next steps

Use the LLM API quickstart for protocol behavior and the Anthropic Messages API Reference for request fields. For more triggers and action inputs, use the official examples and configuration reference.