Skip to content

Commit d2696fd

Browse files
committed
ci: gate optional Claude and security-scan jobs behind repository variables
Add per-job `if:` gates so deployments that don't want or can't run these jobs can switch them off without editing workflows: - ENABLE_CLAUDE_CODE gates the Claude jobs (interactive @claude, the CLAUDE.md audit, and the REVIEW.md drift audit). - ENABLE_WORKFLOW_SECURITY_SCAN gates the Zizmor job, which uploads SARIF and so needs GitHub code scanning enabled. Both default to enabled: a job runs unless its variable is explicitly set to 'false', so existing behaviour is unchanged where the variables are unset.
1 parent 1c7e64a commit d2696fd

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

.github/workflows/check-review-md.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ concurrency:
1414

1515
jobs:
1616
audit:
17+
# Set the ENABLE_CLAUDE_CODE repository variable to 'false' to turn off Claude
18+
# jobs; leave it unset (the default) to keep them enabled.
1719
if: >-
20+
vars.ENABLE_CLAUDE_CODE != 'false' &&
1821
github.event.pull_request.draft == false &&
1922
github.event.pull_request.head.repo.full_name == github.repository
2023
runs-on: ubuntu-latest

.github/workflows/claude-md-audit.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ concurrency:
1515

1616
jobs:
1717
audit:
18+
# Set the ENABLE_CLAUDE_CODE repository variable to 'false' to turn off Claude
19+
# jobs; leave it unset (the default) to keep them enabled.
1820
if: >-
21+
vars.ENABLE_CLAUDE_CODE != 'false' &&
1922
github.event.pull_request.draft == false &&
2023
github.event.pull_request.head.repo.full_name == github.repository
2124
runs-on: ubuntu-latest

.github/workflows/claude.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@ on:
1212

1313
jobs:
1414
claude:
15+
# Set the ENABLE_CLAUDE_CODE repository variable to 'false' to turn off Claude
16+
# jobs; leave it unset (the default) to keep them enabled.
1517
if: |
16-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17-
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18-
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19-
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
18+
vars.ENABLE_CLAUDE_CODE != 'false' &&
19+
(
20+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
21+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
22+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
23+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
24+
)
2025
runs-on: ubuntu-latest
2126
permissions:
2227
contents: write

.github/workflows/workflow-checks.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ jobs:
3636

3737
zizmor:
3838
name: Zizmor
39+
# Uploads SARIF to the Security tab, which requires GitHub code scanning to be
40+
# enabled on the repository. Set the ENABLE_WORKFLOW_SECURITY_SCAN repository
41+
# variable to 'false' to skip this job where code scanning isn't available;
42+
# leave it unset (the default) to run the scan.
43+
if: ${{ vars.ENABLE_WORKFLOW_SECURITY_SCAN != 'false' }}
3944
runs-on: ubuntu-latest
4045
permissions:
4146
security-events: write # Upload SARIF to GitHub Security tab

0 commit comments

Comments
 (0)