Skip to content

Commit 097f89d

Browse files
jmschneiderclaude
andcommitted
Add CI check rejecting \${{ secrets.* }} in action manifests
GitHub's action manifest loader parses every field of an action.yml for \${{ ... }} template expressions and rejects any whose context isn't available at load time, including occurrences inside description docstrings. The \$\${{ escape documented for workflow expressions does not apply at the manifest-loader layer. The new `manifest-template-check` CI job greps every action.yml for \${{ ...secrets.* ... }} patterns and fails the build if any are found. Regression-proofs against the same bug we hit twice today. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 106b1b5 commit 097f89d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,30 @@ jobs:
4141
with:
4242
args: -color
4343

44+
manifest-template-check:
45+
name: Reject \${{ secrets.* }} in action manifests
46+
# GitHub's action manifest loader parses every field for `${{ ... }}`
47+
# template expressions and rejects any whose context (e.g. `secrets`)
48+
# isn't available at action-load time — including occurrences inside
49+
# `description:` docstrings. The `$${{` escape doesn't apply here.
50+
# Reject any such occurrence in action.yml files.
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
- run: |
55+
set -euo pipefail
56+
violators=$(grep -rln '\${{' action.yml sweep/action.yml .github/actions/*/action.yml 2>/dev/null | xargs -I{} grep -l 'secrets\.' {} 2>/dev/null || true)
57+
# Filter to files that actually have `${{ secrets.X }}` (full match)
58+
fail=0
59+
for f in action.yml sweep/action.yml $(ls .github/actions/*/action.yml 2>/dev/null); do
60+
[ -f "$f" ] || continue
61+
if grep -nE '\$\{\{[^}]*secrets\.' "$f"; then
62+
echo "::error file=$f::action manifests cannot reference secrets.* in any field — even in description docstrings, GitHub's loader will reject it."
63+
fail=1
64+
fi
65+
done
66+
exit $fail
67+
4468
yaml-parse:
4569
name: Strict YAML parse
4670
# Catches "mapping values are not allowed in this context" errors that

0 commit comments

Comments
 (0)