Skip to content

Commit 0a1ba7f

Browse files
fix(ci): move secret-scanner Cargo.toml gate from job-level if: to step-level (#20)
`secret-scanner.yml` has had 0 successful runs since creation across all estate consumers — every run completes in 0 seconds with `conclusion=failure` and zero jobs spawned (GitHub Actions startup_failure). YAML is syntactically valid; both action SHAs exist; `gh workflow view` returns the file cleanly. ## Root cause The `rust-secrets` job has a job-level `if:` clause: ```yaml rust-secrets: runs-on: ubuntu-latest if: hashFiles('**/Cargo.toml') != '' ``` GitHub Actions does not support `hashFiles()` in **job-level** `if:` conditions. The docs say `hashFiles` is "available in the runtime environment when steps are running" — i.e. step-level only. At job-eligibility time the expression evaluator rejects the workflow, no jobs are scheduled, the run is marked as a failed startup. Wrapping in ${{ }} makes no difference. ## Fix Mirrors hyperpolymath/stapeln#36. Removes the job-level `if:` line and adds a step-level guard at the top of the existing run block: ```bash if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then echo "No Cargo.toml found — skipping Rust secrets check" exit 0 fi ``` Same semantics (skip when no `Cargo.toml`), but at a context where the expression works. After this fix, the Secret Scanner workflow actually runs trufflehog + gitleaks + (conditionally) rust-secrets as designed.
1 parent 0a01ad3 commit 0a1ba7f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

.github/workflows/secret-scanner.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,15 @@ jobs:
4040
# Rust-specific: Check for hardcoded crypto values
4141
rust-secrets:
4242
runs-on: ubuntu-latest
43-
if: hashFiles('**/Cargo.toml') != ''
4443
steps:
4544
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v4
4645

4746
- name: Check for hardcoded secrets in Rust
4847
run: |
48+
if ! find . -name Cargo.toml -not -path './target/*' -print -quit | grep -q .; then
49+
echo 'No Cargo.toml found — skipping Rust secrets check'
50+
exit 0
51+
fi
4952
# Patterns that suggest hardcoded secrets
5053
PATTERNS=(
5154
'const.*SECRET.*=.*"'

0 commit comments

Comments
 (0)