← Blog

How-to6 min read

Running Claude Code and Codex in GitHub Actions: setup, secrets, and safety

How to run Claude Code (/install-github-app, @claude) and Codex (openai/codex-action@v1) in GitHub Actions, manage secrets, and sync GitHub issues in Mirasim.

Mirasim Work Items with external GitHub issue import and routing rulesMirasim Work Items with external GitHub issue import and routing rules

The short answer

Both Anthropic and OpenAI publish official GitHub Actions. For Claude Code, run /install-github-app inside your repo to install the Claude GitHub App, save an API key or subscription token as a repo secret, and open a PR with @claude workflows. For Codex, add openai/codex-action@v1 to a workflow with secrets.OPENAI_API_KEY, which installs the CLI and runs codex exec on your runner.

Claude Code GitHub ActionsCodex GitHub Action
Official actionanthropics/claude-code-actionopenai/codex-action@v1
Quickest setupgh auth login, then /install-github-app in claudeAdd workflow YAML with openai/codex-action@v1
Repository secretANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKENOPENAI_API_KEY
Typical triggers@claude mentions in issues/PRs, or any GitHub eventpull_request, releases, or custom CI jobs via codex exec
Runner notesWorks on github.com (GitLab has a separate CI guide)Linux / macOS by default (drop-sudo); Windows needs safety-strategy: unsafe

Claude Code GitHub Actions (/install-github-app)

You need repository admin access to set up claude-code-action. Quick setup handles the GitHub App, secret, and workflow PR in one guided flow:

  1. Sign in with GitHub CLI

    Install gh and run gh auth login, then launch claude inside your repository.

  2. Run /install-github-app

    Install the Claude GitHub App on your repo in the browser (granting read/write access to Contents, Issues, and Pull requests), then return to the terminal and pick which workflows (@claude mentions and/or PR review) to add.

  3. Save the credential and merge the PR

    Choose a long-lived subscription token (CLAUDE_CODE_OAUTH_TOKEN) or an API key (ANTHROPIC_API_KEY). Claude Code pushes the workflow files to a branch and opens a PR; once merged, tag @claude in any issue or PR comment.

Once enabled, commenting @claude fix the TypeError in the dashboard component makes Claude reply on the same issue or PR and update the comment as it investigates and pushes commits.

Codex GitHub Action (openai/codex-action@v1)

OpenAI's official action installs the Codex CLI on your GitHub Actions runner, starts a local proxy for your API key, and runs codex exec with either an inline prompt or a checked-in prompt-file. Capture its result through steps.<id>.outputs.final-message or output-file.

Minimal Codex pull-request check with openai/codex-action@v1
name: Codex PR check
on:
  pull_request:
    types: [opened, synchronize, reopened]

jobs:
  codex:
    runs-on: ubuntu-latest
    permissions:
      contents: read
    steps:
      - uses: actions/checkout@v5
        with:
          fetch-depth: 0
          persist-credentials: false

      - name: Run Codex
        id: run_codex
        uses: openai/codex-action@v1
        with:
          openai-api-key: ${{ secrets.OPENAI_API_KEY }}
          prompt-file: .github/codex/prompts/review.md
          sandbox: read-only
          output-file: codex-output.md

Syncing GitHub issues and PRs across agents in Mirasim

GitHub Actions fits headless CI jobs, while interactive bug fixing and cross-agent work are faster when issues, worktrees, and PRs live together without waiting for cold CI runners.

  • Connect GitHub, GitLab, Gitee, or self-hosted hosts: under Settings › Account › Connected accounts › Code hosting, each teammate links their own GitHub, GitLab, Gitee, GitHub Enterprise, or Gitea account so every clone, pull, and push runs under whoever started it.
  • Import external issues into Work Items: sync GitHub, GitLab, Jira, or Gitea issues into Work Items and route them by rules, then kick off Claude Code, Codex, or any of the 11 agents in its own Git worktree and track PR status in the workspace.

Questions

Can I use a Claude subscription instead of an API key in GitHub Actions?
Yes. /install-github-app lets you choose between generating a long-lived subscription token (CLAUDE_CODE_OAUTH_TOKEN) and saving an ANTHROPIC_API_KEY repository secret.
What is the difference between Claude Code GitHub Actions and @claude review?
claude-code-action runs inside your own GitHub Actions workflow files and can answer @claude mentions, edit code, and push commits. Anthropic's managed Code Review service runs on Team and Enterprise plans without workflow YAML.
Does openai/codex-action@v1 work with a ChatGPT subscription?
No. The Codex GitHub Action expects an OpenAI API key stored as a GitHub secret (such as OPENAI_API_KEY). For subscription-backed PR reviews without CI YAML, use Codex's GitHub integration (@codex review).

Sources

Checked on November 29, 2026 against Anthropic's Claude Code GitHub Actions guide (code.claude.com/docs/en/github-actions) and OpenAI's Codex GitHub Action guide (learn.chatgpt.com/docs/github-action). Check those pages for the latest inputs and runner requirements.

Keep reading