Skip to content

Commit 7f078ac

Browse files
tablackburnclaude
andcommitted
ci: graceful-skip ggshield + codecov when their secrets aren't set
Newly-init'd modules from this template fail their first push because the optional GITGUARDIAN_API_KEY (ggshield) and CODECOV_TOKEN (codecov upload) secrets aren't configured yet. This adds `secrets.<NAME> != ''` gates so those steps no-op cleanly until the user wires the secrets up, instead of failing the workflow run. The ggshield gate also subsumes the existing Dependabot check (Dependabot PRs don't have secret access, so the secret-presence check skips them naturally) — but the explicit actor check is kept for self-documentation. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 117bcd4 commit 7f078ac

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

.github/workflows/CI.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ jobs:
118118
./build.ps1 -Task Build,Test -Bootstrap
119119
120120
- name: Upload Coverage to Codecov
121-
if: success() && steps.template_guard.outputs.is_template == 'false'
121+
if: success() && steps.template_guard.outputs.is_template == 'false' && secrets.CODECOV_TOKEN != ''
122122
uses: codecov/codecov-action@v6
123123
with:
124124
token: ${{ secrets.CODECOV_TOKEN }}

.github/workflows/ggshield.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@ jobs:
88
scanning:
99
name: GitGuardian Scan
1010
runs-on: ubuntu-latest
11-
# Skip for Dependabot PRs - they don't have access to secrets and only update dependencies
12-
if: github.actor != 'dependabot[bot]'
11+
# Skip when:
12+
# - Dependabot PR (no secret access, only updates dependencies)
13+
# - GITGUARDIAN_API_KEY not configured (graceful skip for newly-init'd repos
14+
# before the secret is set; Dependabot also lands here because it has no
15+
# secret access, but the explicit actor check above is kept for clarity)
16+
if: github.actor != 'dependabot[bot]' && secrets.GITGUARDIAN_API_KEY != ''
1317
steps:
1418
- uses: actions/checkout@v6
1519
with:

0 commit comments

Comments
 (0)