Skip to content

Commit af9aab6

Browse files
committed
ci: add AI security review on pull requests
Brings this starter to the same PR-review baseline as mcp-server-starter and python-mcp-server-starter, which were the only two of the eleven that had it. Byte-identical to the mcp-server-starter workflow. The job gates on CLAUDE_API_KEY being present and emits a notice rather than failing when it is unset, so forks and repos freshly created from this template stay green without configuring a secret. Action pinned by commit SHA, bumped via the existing Dependabot actions group.
1 parent 563a099 commit af9aab6

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: AI Security Review
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
pull-requests: write
8+
contents: read
9+
10+
jobs:
11+
ai-review:
12+
runs-on: ubuntu-latest
13+
steps:
14+
# Gate the job on the secret being set so forks / fresh clones don't
15+
# red-fail. The `secrets` context can't be used directly in `if:`, so we
16+
# route through a step output. When CLAUDE_API_KEY is unset, the job
17+
# emits a notice and skips the actual analysis steps.
18+
- name: Check CLAUDE_API_KEY presence
19+
id: gate
20+
env:
21+
API_KEY: ${{ secrets.CLAUDE_API_KEY }}
22+
run: |
23+
set -euo pipefail
24+
if [ -z "${API_KEY:-}" ]; then
25+
echo "::notice::CLAUDE_API_KEY secret is not set — skipping AI security review. Set the secret in repo settings to enable."
26+
echo "skip=true" >> "$GITHUB_OUTPUT"
27+
else
28+
echo "skip=false" >> "$GITHUB_OUTPUT"
29+
fi
30+
31+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
32+
if: steps.gate.outputs.skip == 'false'
33+
with:
34+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
35+
fetch-depth: 2
36+
37+
# Pinned to a specific commit SHA. Bumped via Dependabot (group: actions).
38+
- name: AI security review
39+
if: steps.gate.outputs.skip == 'false'
40+
uses: anthropics/claude-code-security-review@0c6a49f1fa56a1d472575da86a94dbc1edb78eda
41+
with:
42+
comment-pr: true
43+
claude-api-key: ${{ secrets.CLAUDE_API_KEY }}

0 commit comments

Comments
 (0)