OmniscioGuidesClaude Code GitHub Action examples
Claude Code GitHub Action examples: five workflows you can copy
An example is only useful if you can paste it. Four of these five workflows are Anthropic's own files, reproduced whole; where a page adds a second, self-contained version, it says so on its face. This page gives you the shortest one to copy right now, then hands you the other four.
Pick the job you want automated. Each of the five pages stands alone: the full YAML, what each key does, the permissions it needs, how to prove it ran, and what to check when it does not.
Last checked against Anthropic's documentation and the action's own examples on November 25, 2026. By the Omniscio team. Updated .
The shortest example
Here is something to copy before you read anything else. It is Anthropic's own smallest workflow: save it as .github/workflows/claude.yml, and from the moment it is merged, a comment containing @claude starts a run that can edit your code and push a commit.
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 }}Two things have to exist before it does anything: the Claude GitHub App installed on the repository, and the ANTHROPIC_API_KEY repository secret. If both are there, @claude fix the TypeError in the user dashboard component is the whole interface. The mention page carries the longer file, with the issue events and an explanation of every permission.
Source: "Respond to @claude mentions" in Anthropic's GitHub Actions page, read November 25, 2026.
The five examples
They are ordered by how much they change: the first three react to something a person does, the last two act on their own or on a failure.
| Workflow | Runs when | Writes back |
|---|---|---|
| Review every pull request | A pull request is opened, updated, reopened or marked ready | Inline review comments and a tracking comment |
| Answer @claude mentions | Someone types @claude in a comment, review or new issue | One comment, updated as it works |
| Triage new issues | An issue is opened | Labels, and a comment naming a duplicate |
| Update dependencies weekly | A cron schedule, or a manual run | A branch with the update, and an issue |
| Fix a failing CI run | Your CI workflow finishes with a failure | A new branch carrying the fix |
The first three are near the simplest thing the action does: a trigger, a prompt, and a comment back. The last two carry real scaffolding, because the job itself needs state one step cannot see — which pull request a failed run belonged to, what the failing job logged, and a branch to put the fix on.
The failure each one hits
- Review: the job goes green and no comment appears, because the tool that posts was never allowed.
- Mentions: nothing happens at all — usually the App, the secret, the word
@claude, or the commenter's write access. - Triage: it fails on
/label-issue, a command that belongs to the action's repository rather than yours. - Dependency update: a schedule that worked for weeks goes quiet, usually because a bot is credited with it.
- CI fix: the run never starts, because
workflows: ["CI"]must match the watched file'sname:exactly.
Sources: the examples directory and Solutions & Use Cases in the claude-code-action repository, and Anthropic's GitHub Actions page, all read November 25, 2026.
Interactive or automation mode
The action decides how to run from your workflow file alone, and the deciding input is prompt.
- No
prompt— interactive mode. Claude waits for the trigger phrase,@claudeby default, in an issue or pull request comment, in a pull request review, or in the body or title of a newly opened issue. This is the mention workflow, and only that one. - A
prompt— automation mode. Claude runs as soon as the event fires. The results go to the workflow run log unless the prompt directs Claude to comment and it has a tool that can post. The review, triage, dependency and CI workflows are all in this mode.
That single rule explains the most common disappointment with these examples: a workflow that reviews pull requests but leaves no comment. In automation mode nothing is posted by default, and a plain prompt has no GitHub API access until claude_args grants the tool it needs with --allowedTools.
Source: "Interactive and automation modes" in Anthropic's GitHub Actions page, read November 25, 2026.
Copying one safely
Every example runs on your own repository's code with your repository's credentials. Four habits keep that from becoming a hole.
- Grant the permissions the job needs and no more. A review reads contents, writes pull request comments and exchanges an OIDC token. Three of the five need
contents: write— mentions, dependency updates and CI fixes — because those are the three that push a commit. - Know what happens with fork pull requests. The action skips pull requests from forks by default, so it never checks out a stranger's code. You can opt in with
allow_fork_prs: "true", but read Anthropic's note on running code from pull requests first: on a public repository GitHub withholds secrets from fork-triggered runs anyway. - Remember who can trigger. On issue and pull request events the triggering user needs write access, and a bot actor is rejected unless listed in
allowed_bots. Listing a bot is a real permission: on a public repository an allowed bot is not checked for access. The triage workflow is the one designed exception — it admits people without write access on purpose, and its page explains what that costs. - Cap the run.
--max-turnsinclaude_argslimits how many turns one run may take, and a job-leveltimeout-minutesstops a runaway job.
A fifth habit applies to the two workflows that read a pull request's text. Anyone can open an issue or a pull request, so its title and body are words an outsider wrote. Pass only the number and let Claude read the rest with its tools, which is what Anthropic's own examples do.
Sources: "Access Control" and "Pull requests from forks" in the Security guide; "Who can trigger runs", "Run a skill" and "Manage costs" in Anthropic's GitHub Actions page; "Custom Prompt Templates" in Custom Automations. Read November 25, 2026.
How to confirm it ran
Three places, in this order. The first tells you whether it ran at all; the second tells you what it did; the third tells you it did what you meant.
- The Actions tab. Your repository's Actions tab lists the runs of the workflows in it. Pick the workflow by name, then the run, then the job — a run that was skipped for its own
if:is in that list too, which is why the log is the next stop rather than the colour of the tick. - The run log. Open the run, then the job, and you get the full execution trace, which is what Anthropic's FAQ points you at when you want to see what Claude is doing.
- What it left behind. A review leaves inline comments and, with
track_progress, one comment whose checkboxes tick as the work proceeds. A mention leaves one reply comment that is updated in place rather than a new one per step. The dependency and CI workflows leave a branch.
Sources: "How can I debug what Claude is doing?" and "Why does Claude only update one comment instead of creating new ones?" in the action's FAQ; the tracking-comment description in the comprehensive review example. Read November 25, 2026.
Before any of this: the setup
These pages assume the Claude GitHub App is installed and the secret exists. If they are not, every workflow here runs, fails, and tells you nothing useful about why.
Run /install-github-app inside the repository: it installs the app and writes the secret for you. The Claude Code GitHub Actions guide covers both setup roads, who is allowed to trigger a run, what a run costs and how to take it out again.
Self-hosted GitHub is a different setup rather than a different workflow file: Claude Code on GitHub Enterprise Server covers what changes. GitLab is a different job file entirely: Claude Code in GitLab CI/CD.
Where these answers come from
- Claude Code GitHub Actions — setup, the two modes, who can trigger, the review example, the schedule example, costs and troubleshooting.
- anthropics/claude-code-action — the action itself, its README and its
examples/directory, which is where four of these five workflows are reproduced from. - Solutions & Use Cases — Anthropic's longer worked examples for review, triage and scheduled maintenance.
- Usage — the full inputs table, the permission mode, and the deprecated inputs.
- Security — access control, fork pull requests, and what a session can leave behind.
- Running Claude Code from a terminal instead of a workflow is headless mode, which is the same print mode a CI job can call directly.
Common questions
Where do these example workflows come from?
From Anthropic. Four are reproduced from files in the action's repository or the Solutions guide. The dependency page also carries a version narrowed to dependencies, and the triage page a self-contained one; both say so on their face, and both are built only from keys those sources document.
Can I put all five in one repository?
Yes. They are separate files with separate triggers. Give each its own file name under .github/workflows/, and keep each file's permissions: block to what that job needs rather than copying the widest one.
Which one should I start with?
The @claude mention workflow. It runs only when someone asks, it is one of the two files Anthropic's quick setup writes, and it needs no prompt design to be useful.
Do these examples cost money?
Every run spends GitHub Actions minutes and API tokens, or your subscription if you authenticated with an OAuth token. Set --max-turns in claude_args and a job timeout-minutes to bound both.