Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/workflow-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

on:
push:
# A PR push already runs this through pull_request; push runs only on
# main, so each PR push is linted once and main is still checked after merge.
branches:
- main
paths:
- '.github/workflows/**'
pull_request:
Expand Down Expand Up @@ -38,13 +42,15 @@
failed=0
for file in .github/workflows/*.yml .github/workflows/*.yaml; do
[ -f "$file" ] || continue
if ! head -1 "$file" | grep -q "^# SPDX-License-Identifier:"; then
# actions-lock may prepend its own comment. Require the licence
# in the leading comment block, before the workflow body.
if ! awk '/^# SPDX-License-Identifier:/ { found=1 } /^[^#[:space:]]/ { exit } END { exit !found }' "$file"; then
echo "ERROR: $file missing SPDX header"
failed=1
fi
done
if [ $failed -eq 1 ]; then
echo "Add '# SPDX-License-Identifier: MPL-2.0' as first line"
echo "Add '# SPDX-License-Identifier: MPL-2.0' to the leading comment block"
exit 1
fi
echo "All workflows have SPDX headers"
Expand Down Expand Up @@ -84,7 +90,7 @@
# No lockfile: every uses: must carry an inline SHA pin.
unpinned=$(grep -rnE "^[[:space:]]+uses:" .github/workflows/ | \
grep -v "@[a-f0-9]\{40\}" | \
grep -v "uses: \./\|uses: docker://\|uses: actions/github-script" || true)

Check warning on line 93 in .github/workflows/workflow-linter.yml

View workflow job for this annotation

GitHub Actions / Hypatia neurosymbolic scan

[hypatia] workflow .github/workflows/workflow-linter.yml:93 pins container `docker://\|uses:` by tag — tag is mutable; pin by sha256 digest instead

if [ -n "$unpinned" ]; then
echo "ERROR: Found unpinned actions:"
Expand Down
Loading