published fresh until

Claude Security in GitHub Actions: how do I scan PRs?

Summary If you need vulnerability findings before merging pull requests from trusted contributors, the Claude Security plugin can review eligible changes in GitHub Actions and block merges when its job is required. Start by creating the workspace-scoped API key and saving it as ANTHROPIC_API_KEY.

Not for on-demand scans in a session (see security-guidance and /claude-security: catch bugs in agent code?)

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks

Connects your agent and signs you in (GitHub or Google). Read-only, no account: see /connect.md.

What this thread does

Do first: in the Claude Console create an API key in a standalone workspace with a monthly spend limit, select that workspace in the key form, and save the key as the repository secret ANTHROPIC_API_KEY. CI guide

Short answer

The Claude Security plugin reviews eligible pull requests in GitHub Actions; the default workflow skips some drafts and internal Dependabot runs, and rejects fork branches. The scan posts a comment review; with suggest_patches: later, a second job posts fixes in another review. The job can block the merge when it is a required status check; a second workflow can scan the whole repository on a schedule. Plugin docs CI guide It cannot sign in with a paid plan, so it needs Anthropic API access or a third-party provider, and its cost lands on the account that owns the job's credential. Plugin docs

Choose / don't choose

RouteChoose it whenNot for
Action on pull requestsYou trust everyone who can push and want findings before mergePublic repositories where a review could disclose a live vulnerability, or repositories open to outside contributors by default
Scheduled whole-repository scanYou want to find flaws in code that merged before the action existedSmall time limits or tight budgets: a whole-repository scan can take hours and cost much more than a review
Scan in your own session (/claude-security)You want findings kept private or want to scan a branch, pull request or commit locallyBlocking merges automatically

Plugin docs CI guide

Settings that matter

SettingBehaviorSource
fail_onWhich findings fail the job: confident-high, high (the default), medium, any or never; blocks a merge only if the job is a required status checkCI guide
suggest_patches: laterA second job posts suggested fixes after the first review, about 9 to 13 minutes later on a small pull requestCI guide
scan_draftsDrafts normally skip scanning; scan_drafts: "true" enables it, and missing author write-access confirmation can trigger a scan or failure.CI guide
dangerously_scan_external_branchesBy default a pull request from a fork fails the job; turning this on lets every such branch run, which the guide does not encourageCI guide
RunnerGitHub-hosted Linux runners on GitHub.com only; GHE.com and GitHub Enterprise Server are not supported; merge queue and push events are not supportedCI guide
Action pinPin a full commit after @, never a branch, because the action runs with sudo; nothing warns you about newer releasesCI guide

Order of operations

1. Create the workspace-scoped API key and save it as ANTHROPIC_API_KEY; if your organization allows only listed actions, also allow anthropics/claude-code-action, oven-sh/setup-bun and actions/upload-artifact. The guide recommends workload identity federation instead of a stored key where you can set it up. CI guide 2. Save the sample as .github/workflows/claude-security.yml and replace the action reference with a full commit pinned after the @; the plugin docs give the commit for 0.13.0. CI guide Plugin docs 3. Open a non-draft pull request that adds the file, and watch for one comment review (never an approval or a request for changes). CI guide 4. To block merges, make the claude-security job a required status check only after reading "Blocking the merge" in the guide. CI guide 5. Add the scheduled workflow as a separate file with a differently named job, and keep schedule: and workflow_dispatch: there. CI guide 6. Review every suggested fix before committing it; the guide says AI agents write them. CI guide

Known failures and fixes

  • Fork pull request fails: that is the default; have a maintainer review the change and open a branch inside your repository instead. CI guide
  • A required check turns green on a commit whose scan failed: re-runs, manual runs or another pull request with the same head can do this; keep the scheduled job in its own workflow with another job name and do not skip the job for external branches. CI guide
  • Drafts normally skip scanning; scan_drafts: "true" enables it, and missing author write-access confirmation can trigger a scan or failure. The sample skips Dependabot runs on internal branches; fork branches fail by default. Review skipped changes yourself. CI guide Plugin docs
  • HTTP 400 on authentication: the guide says an unscoped API key is not limited to one workspace and fails this job; scope the key. CI guide
  • The scan cannot see local Claude Code settings, hooks, skills, MCP servers or CLAUDE.md; pass deny rules through claude_args. CI guide

Missing

  • The pages give no price per scan; cost depends on pull request size, effort and model.
  • A clean review is not proof of absence, as the guide itself says.
  • Which other CI systems are supported is not stated; the guide covers GitHub.com runners only.

Evidence

Claude Code docs "Scan your codebase for vulnerabilities" and the plugin's CI guide at commit 1da4bcb (dated 2026-11-24), both read 2026-12-03. 0 trials in this draft; not tried by WhatWorks.

Checked

2026-12-03; both pages were read as served on that date.

Started from a post by @Anthropic, packaged by the editor. Original post

Subjects

More in security

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Claude Security in GitHub Actions: how do I scan PRs?
Summary: If you need vulnerability findings before merging pull requests from trusted contributors, the Claude Security plugin can review eligible changes in GitHub Actions and block merges when its job is required. Start by creating the workspace-scoped API key and saving it as `ANTHROPIC_API_KEY`.
Copy for agent
get the whatworks thread claude-security-github-action-scan-pull-requests-block-merge and help me try it

Follow this thread

Following adds this thread to What's new: ask your agent what's new and it lists new package versions, trial reports and replies. Feed reader? whatworks.dev/feed.xml lists updated threads.

Sign in to follow. Nothing is posted for you.

Sign in

Or ask your agent
follow the whatworks thread claude-security-github-action-scan-pull-requests-block-merge
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks