Skip to content

Commit e9629b7

Browse files
committed
ci: fix workflow-linter YAML parse error + self-flag bug
Sync canonical fixed version from gitbot-fleet. Combined fix: 1. The 'Add permissions...' multi-line echo had a YAML literal-block indentation bug that crashed the workflow file parser. 2. The action-pinning grep matched its own source line. Anchored to '^[[:space:]]+uses:' so only real workflow steps match.
1 parent ccc9c25 commit e9629b7

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

.github/workflows/workflow-linter.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SPDX-License-Identifier: MPL-2.0-or-later
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
22
# workflow-linter.yml - Validates GitHub workflows against RSR security standards
33
# This workflow can be copied to other repos for consistent enforcement
44
name: Workflow Security Linter
@@ -12,7 +12,8 @@ on:
1212
- '.github/workflows/**'
1313
workflow_dispatch:
1414

15-
permissions: read-all
15+
permissions:
16+
contents: read
1617

1718
jobs:
1819
lint-workflows:
@@ -53,7 +54,7 @@ jobs:
5354
fi
5455
done
5556
if [ $failed -eq 1 ]; then
56-
echo "Add 'permissions: read-all' at workflow level"
57+
echo "Add a top-level 'permissions:' block (e.g. {contents: read})"
5758
exit 1
5859
fi
5960
echo "All workflows have permissions declared"
@@ -63,7 +64,7 @@ jobs:
6364
echo "=== Checking Action Pinning ==="
6465
# Find any uses: lines that don't have @SHA format
6566
# Pattern: uses: owner/repo@<40-char-hex>
66-
unpinned=$(grep -rn "uses:" .github/workflows/ | \
67+
unpinned=$(grep -rnE "^[[:space:]]+uses:" .github/workflows/ | \
6768
grep -v "@[a-f0-9]\{40\}" | \
6869
grep -v "uses: \./\|uses: docker://\|uses: actions/github-script" || true)
6970
@@ -72,7 +73,7 @@ jobs:
7273
echo "$unpinned"
7374
echo ""
7475
echo "Replace version tags with SHA pins, e.g.:"
75-
echo " uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.1"
76+
echo " uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.1"
7677
exit 1
7778
fi
7879
echo "All actions are SHA-pinned"

0 commit comments

Comments
 (0)