skip to content

Who can trigger a run of anthropics/claude-code-action@v1, and how do you widen that set safely for outside contributors or bots?

level: seniorimportance: should knowfreq 14%

answer

  1. two checks before Claude starts
  2. the triggering actor's repository permission
  3. allowed_non_write_users needs its own github_token
  4. allowed_bots and loops between bots
  5. schedules are attributed to a user

basics

~20 s

Before Claude starts, the action checks the triggering actor: on issue and PR events the user needs write access, and bot actors are rejected unless listed in allowed_bots. allowed_non_write_users, with your own github_token, admits named users without write access.

solid answer

~50 s

`anthropics/claude-code-action@v1` runs two checks on the triggering actor in both modes, and the run fails if either rejects it. The **write-access check** applies to issue and pull request events: a commenter without write access cannot start Claude, unless you name them in `allowed_non_write_users` and pass your own `github_token`. Events nobody authors, such as `schedule`, skip it. The **human-actor check** applies to every event and rejects bot actors not listed in `allowed_bots`, which stops bots triggering Claude in a loop; a scheduled run counts as the user who last changed the `cron` line, so a bot that edited it must be listed. When you set `allowed_non_write_users`, the action also turns on `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`, stripping credentials from the environments of Claude's Bash commands, hooks and stdio MCP servers. Widen the set narrowly and keep Claude's tools narrow too.

go deeper

for a junior

Know that by default only people with write access can make the action run Claude, and that bots are rejected.

for a middle

Name both checks, which events each applies to, and the two inputs that widen them, including the github_token that allowed_non_write_users needs.

for a senior

Diagnose the scheduled run that fails because a bot last edited the cron line, and pair any widening with the env scrub, narrow tools and turn caps.

for a principal

Decide whether outside contributors should be able to reach a write-capable agent at all, and what review gate every pushed branch must still pass.

## Why the check exists The Claude Code GitHub Action, `anthropics/claude-code-action@v1`, gives an agent a repository checkout, the Claude GitHub App's write permissions and an API credential. Whoever can start a run can point that agent at something. So before Claude starts, the action checks the **triggering actor**, the GitHub account whose event fired the workflow, in **both** interactive (`@claude`) and automation (`prompt`) mode. If either check rejects the actor, the run fails. When a mention seemingly does nothing, the actor checks are one of the first places to look: the documented troubleshooting list asks you to confirm the commenting user has write access, alongside checking that the app is installed, workflows are enabled and the secret is set. ## The two checks | Check | Applies to | Rejects | Override | | - | - | - | - | | **Write access** | issue and pull request events | a user without write access to the repository | `allowed_non_write_users` plus your own `github_token` | | **Human actor** | every event, scheduled runs included | any bot actor | `allowed_bots` | Points that confident answers get wrong: - The workflow's `if: contains(github.event.comment.body, '@claude')` line is **not** the authorization check. It only keeps runners from starting on comments that do not mention Claude; the actor checks run inside the action. - On a public repository, anyone can comment, but a commenter without write access is rejected by default, so a drive-by `@claude push this` does nothing. - Events no user authors, such as `schedule`, skip the write-access check, but **not** the human-actor check. ## Admitting people without write access Some teams want outside contributors or triagers to be able to ask Claude for help. The input for that is `allowed_non_write_users`, and it works only when you also pass your own `github_token` input rather than relying on the app token the action uses by default. Two effects follow: 1. Text written by people who cannot push to the repository now reaches an agent that holds the action's permissions. How an attacker would use such text belongs to the security material on agent tool attacks; on this surface the controls are the ones you configure. 2. The action automatically sets `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`, which removes credentials, recognised by variable name or by the shape of the value, from the environments of the subprocesses Claude Code starts: Bash commands, hooks and stdio MCP servers. Claude Code keeps the credential for its own API calls, and the scrub leaves GitHub tokens in place, so it is one layer, not a sandbox. Pair the widening with narrow tool grants in `claude_args`, a short `--max-turns`, minimal workflow permissions, and review of everything Claude pushes before it merges. ## Bots, loops and scheduled runs The human-actor check exists so that bots cannot trigger Claude, whose own comments and pushes are themselves events, in an endless loop. If a dependency bot or another automation genuinely needs to start Claude, list that account in `allowed_bots`. Scheduled workflows have a subtle actor. GitHub attributes a scheduled run to a repository user, usually the one who **last changed the workflow's `cron` schedule**. If that was a bot, for example an automation that rewrote the workflow file, every scheduled run now fails the human-actor check until the bot is listed in `allowed_bots` or a person makes the last change. ## Forks and missing secrets A separate effect, owned by GitHub rather than the action: on public repositories, GitHub withholds secrets from runs triggered by pull requests from forks. A `pull_request` review workflow therefore has no Claude credential on a fork's PR and runs only for branches in the same repository. Choosing a different trigger to work around that is a workflow-design decision with its own risks, covered by the GitHub Actions material on triggers. ## A checklist for widening access - Name individual users in `allowed_non_write_users`; avoid opening it to everyone. - List only the specific bot accounts that need to start Claude in `allowed_bots`. - Keep `--allowedTools` to what the job needs, and cap `--max-turns`. - Grant the job only the workflow permissions it uses. - Treat every branch Claude pushes as an untrusted contribution until a person reviews it.

  • A nightly anthropics/claude-code-action@v1 workflow started failing after an automation account rewrote its cron line. Why?
    GitHub attributes a scheduled run to the repository user who last changed the workflow's `cron` schedule. That actor is now a bot, and the human-actor check, which applies to scheduled runs too, rejects bot actors not listed in `allowed_bots`. List that account in `allowed_bots`, or have a person make the last change to the schedule.
  • What does the action change inside Claude's environment once allowed_non_write_users is set?
    It sets `CLAUDE_CODE_SUBPROCESS_ENV_SCRUB`, so credentials such as `ANTHROPIC_API_KEY` are stripped from the environments of Bash commands, hooks and stdio MCP servers that Claude Code starts, matched by variable name or by value shape. Claude Code keeps the key for its own API calls and GitHub tokens stay, so it narrows what injected text can read; it does not replace narrow tool permissions.
  • Why does a pull_request review workflow using the action never review pull requests from forks of a public repository?
    GitHub withholds secrets from runs triggered by fork pull requests on public repositories, so the step has no `ANTHROPIC_API_KEY` or OAuth token to call Claude with. The documented behaviour is that such a review runs only on pull requests from branches in the same repository.

  • The if: contains(..., '@claude') line is what stops strangers triggering Claude
  • Anyone who can comment on a public repository can make Claude push
  • allowed_non_write_users works with the default app token alone
  • Scheduled runs skip every actor check because no person authored them
  • Bots may trigger Claude by default since a bot cannot start a loop