Skip to content

Commit 9574be4

Browse files
mfoclaude
andcommitted
Trigger security review on PR approval, fail on findings
- Trigger on pull_request_review (approved) instead of pull_request - Add step to fail the job if findings > 0 - Works with branch protection bypass for false positives Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 86fb727 commit 9574be4

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
name: Claude Code Security Review
22

33
on:
4-
pull_request:
5-
branches: [main]
4+
pull_request_review:
5+
types: [submitted]
66

77
permissions:
88
contents: read
99
pull-requests: write
1010

1111
jobs:
1212
security-review:
13+
if: github.event.review.state == 'approved'
1314
runs-on: ubuntu-latest
1415
steps:
1516
- uses: actions/checkout@v4
1617
with:
17-
ref: ${{ github.event.pull_request.head.sha || github.sha }}
18+
ref: ${{ github.event.pull_request.head.sha }}
1819
fetch-depth: 2
1920

2021
- uses: anthropics/claude-code-security-review@main
22+
id: scan
2123
with:
2224
claude-api-key: ${{ secrets.CLAUDE_API_KEY }}
23-
upload-results: 'false'
24-
run-every-commit: 'true'
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
25+
26+
- name: Fail if security findings
27+
if: steps.scan.outputs.findings-count > 0
28+
run: |
29+
echo "::error::Security review found ${{ steps.scan.outputs.findings-count }} finding(s). Review the comments on this PR."
30+
exit 1

0 commit comments

Comments
 (0)