Put a coding agent in your pipeline.

Claude, Codex, Copilot and Gemini can all work inside GitHub now. How to pick one, wire it up in one file and keep it on a short leash.

A traffic light on a pole beside a quiet road
Photo by Sandy Ravaloniaina on Unsplashdithered by Cyborb

A coding agent in CI is an AI agent that runs inside your GitHub Actions workflows. It reviews pull requests, makes fixes when someone asks in a comment, and triages new issues. It leaves its work as comments, commits or a pull request, and a human still decides what merges.

As of September 2026, GitHub, Anthropic, OpenAI and Google all offer an official way to do this. This guide compares them and walks through a minimal workflow file copied from Anthropic’s docs. Then it covers the part that matters most: what the agent can touch, who can trigger it, and what it costs.

The short version
  • In CI, agents review pull requests, answer comments with fixes, triage issues and run scheduled chores.
  • The official options: Copilot’s cloud agent, Claude and Codex as assignable agents on GitHub, vendor Actions, and GitHub Agentic Workflows.
  • Start from the vendor’s own workflow file, keep the API key in GitHub Secrets, and grant only the permissions the job needs.
  • Treat every issue, comment and diff as untrusted input, and let only people with write access trigger the agent.
  • Control cost with narrow triggers, turn limits, timeouts and one run at a time.

What a coding agent can do in CI

Four jobs cover most of the value:

  • Review pull requests. The agent reads the diff when a PR opens and comments on bugs, risks and missing tests.

  • Fix on request. A teammate comments “@claude fix the failing test in checkout”, and the agent pushes a commit to the branch.

  • Triage issues. It labels new issues, spots duplicates and asks the reporter for missing steps to reproduce.

  • Run scheduled chores. A nightly job summarizes yesterday’s commits or open issues.

Reviews are the safest place to start, because the agent only comments. If reviews are all you need, compare dedicated AI code review tools before you build a workflow.

The official options in 2026

There are three shapes. GitHub runs the agent for you, a vendor Action runs inside a workflow you own, or GitHub compiles a plain-language workflow into a locked-down Action.

OptionHow you start itWhere it runsStatus, September 2026
Copilot cloud agent (GitHub)Assign an issue to Copilot, or ask in chatA GitHub Actions-powered environmentPaid Copilot plans
Claude and Codex on GitHubAssign an issue, or mention the agent in a PROn GitHub, with the same protections as Copilot’s agentPublic preview
Claude Code GitHub Action (Anthropic)@claude in a comment, or any event with a promptYour workflow@v1 (latest tag v1.0.233)
Codex GitHub Action (OpenAI)Any workflow event with a promptYour workflow@v1 (latest tag v1.12)
Gemini CLI GitHub Action (Google)@gemini-cli comments or workflow eventsYour workflowPre-1.0 (v0.1.22)
GitHub Agentic WorkflowsMarkdown workflows compiled to ActionsA sandboxed container in ActionsPublic preview since June 2026

How to choose: if you want no YAML at all, assign issues to Copilot, Claude or Codex on GitHub. If you want control over triggers, prompts, models and permissions, use a vendor Action. Agentic Workflows suit many small automations under strict guardrails: they are read-only by default, and writes go through validated “safe outputs”. They can drive Copilot, Claude Code, Codex, Gemini or Pi.

Still choosing an agent for day-to-day work? Our Claude Code, Codex and Cursor comparison covers how they differ outside CI.

One caveat for Gemini: in June 2026, Google moved consumer users from Gemini CLI to its new Antigravity CLI. Gemini CLI, which the Gemini Action runs, stays available with paid Gemini API keys and enterprise licenses.

Add a coding agent to GitHub Actions in one file

This is the minimal setup from Anthropic’s documentation for the Claude Code GitHub Action. The Codex and Gemini Actions follow the same pattern: an API key in Secrets, a workflow file and a trigger.

  1. Install the GitHub App

    Install the Claude GitHub App on the repository. You need admin access. Running /install-github-app inside Claude Code installs the app and adds the secret for you, then prepares a pull request with the workflow.

  2. Add the key as a secret

    In the repository settings, open Secrets and variables, then Actions, and add ANTHROPIC_API_KEY. Subscribers can use a CLAUDE_CODE_OAUTH_TOKEN from claude setup-token instead.

  3. Commit the workflow

    Save the file below as .github/workflows/claude.yml on your default branch.

  4. Mention the agent

    In any issue or PR comment, write @claude followed by the request. Claude replies in a comment on the same thread and updates it as it works.

.github/workflows/claude.yml
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 }}

The if line stops the job before a runner starts on comments that do not mention @claude. The permissions block lets the agent push commits and comment, id-token: write serves the Action’s GitHub App sign-in, and actions: read lets it read CI results.

We copied this file from the docs as of September 2026. Both actionlint 1.7.12 and a check against the public JSON schema for GitHub workflows passed it. We could not run it on a live repository, because that step needs your app install and your API key.

Lock down permissions and secrets

An agent in CI holds real credentials and reads text written by strangers. Plan for both:

  • Grant the least access. A review-only job does not need write access to code. Anthropic’s own review example uses read permissions for contents, pull requests and issues.

  • Keep keys in Secrets. Never write a key into the workflow file. Use a dedicated CI key you can revoke on its own, and follow our guide to keeping API keys safe.

  • Limit who can trigger it. The Claude Action requires write access from whoever triggers it on issue and PR events, and rejects bots unless you allow them. Copilot’s agent also answers only to people with write access.

  • Treat all text as untrusted. Issue bodies, comments and diffs can carry instructions aimed at the agent. Allow only the tools a job needs (--allowedTools in claude_args), and review everything it writes.

  • Leave fork pull requests alone. On public repositories, GitHub withholds secrets from runs triggered by fork PRs. Do not work around that with pull_request_target and a checkout of the fork’s code, which GitHub’s security guide warns against.

  • Pin the Action. GitHub calls pinning to a full commit SHA “the only way to use an action as an immutable release”.

GitHub’s hosted agents add their own limits. Copilot’s cloud agent pushes to a single branch, usually a new copilot/ one, and workflows on its pull requests wait until someone with write access approves them. The person who asked for its pull request cannot approve it, and its internet access runs through a firewall. Claude and Codex on GitHub get the same protections.

Before you turn it on0 of 6

The agent’s changes still need the same checks as any AI-written code. Our checklist for securing AI-generated code covers the scanners to run on its pull requests.

How much does a coding agent in CI cost?

Every run has two meters. Runner time counts against your GitHub Actions minutes, and the model bills tokens to your API key or subscription. Copilot’s agent, and Claude and Codex on GitHub, use Actions minutes plus AI credits from your Copilot plan.

Cap the two obvious leaks: runs nobody needed and runs that never end. These additions to the workflow above do both, and we validated the combined file the same way:

YAML
    timeout-minutes: 15
    concurrency:
      group: claude-${{ github.event.issue.number || github.event.pull_request.number }}
YAML
          claude_args: "--max-turns 10"

The first snippet goes under runs-on. Its timeout ends a stuck job, and concurrency allows one run per issue or pull request at a time. The second goes under anthropic_api_key and limits how many turns the agent takes. Beyond that, write specific requests, keep CLAUDE.md short because the agent reads it on every run, and use a cheaper model for routine reviews with --model.

FAQ

Can a coding agent merge its own pull requests?

It should not. Keep branch protection that requires a human review. Copilot’s cloud agent is built so the person who asked for a pull request cannot approve it, and Anthropic’s docs tell you to review Claude’s changes before merging.

Why doesn’t CI run on the agent’s commits?

GitHub does not trigger workflows on commits made with the default GITHUB_TOKEN. With the Claude Action, leave out the github_token input so it signs in as the Claude GitHub App, or pass a token from your own app.

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

Yes, on Pro, Max, Team and Enterprise plans. Run claude setup-token, save the result as CLAUDE_CODE_OAUTH_TOKEN, and pass it as claude_code_oauth_token. For a key shared across an organization, Anthropic recommends an API key instead.

Should I use Copilot’s agent or my own workflow?

Use a hosted agent to start fast and let GitHub own the guardrails. Use your own workflow when you need custom triggers, a specific model, a scheduled job, or tight control over permissions.

Read next: how to review AI-written code when the agent’s pull request lands.

Sources
  1. Claude Code GitHub Actions, Claude Code documentation, accessed September 2026
  2. anthropics/claude-code-action releases, Anthropic on GitHub, accessed September 2026
  3. openai/codex-action, OpenAI on GitHub, accessed September 2026
  4. google-github-actions/run-gemini-cli, Google on GitHub, accessed September 2026
  5. An important update: Transitioning Gemini CLI to Antigravity CLI, Google Developers Blog, May 2026
  6. About GitHub Copilot cloud agent, GitHub Docs, accessed September 2026
  7. Risks and mitigations for GitHub Copilot cloud agent, GitHub Docs, accessed September 2026
  8. About third-party coding agents, GitHub Docs, accessed September 2026
  9. GitHub Agentic Workflows is now in public preview, GitHub Changelog, June 2026
  10. What are Agentic Workflows?, GitHub Next, accessed September 2026
  11. Secure use reference, GitHub Docs, accessed September 2026
cyborb.ai

Stop reading about it. Build it.

Describe what you want in plain words. Cyborb plans the work, writes and runs the code, makes the assets, and puts the result online.

Download Cyborb

Free to start. No card required.