Skip to content

Commit 2854f67

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 b2f28c3 commit 2854f67

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

.github/workflows/workflow-linter.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ jobs:
5454
fi
5555
done
5656
if [ $failed -eq 1 ]; then
57-
echo "Add 'permissions:
58-
contents: read' at workflow level"
57+
echo "Add a top-level 'permissions:' block (e.g. {contents: read})"
5958
exit 1
6059
fi
6160
echo "All workflows have permissions declared"
@@ -65,7 +64,7 @@ jobs:
6564
echo "=== Checking Action Pinning ==="
6665
# Find any uses: lines that don't have @SHA format
6766
# Pattern: uses: owner/repo@<40-char-hex>
68-
unpinned=$(grep -rn "uses:" .github/workflows/ | \
67+
unpinned=$(grep -rnE "^[[:space:]]+uses:" .github/workflows/ | \
6968
grep -v "@[a-f0-9]\{40\}" | \
7069
grep -v "uses: \./\|uses: docker://\|uses: actions/github-script" || true)
7170

0 commit comments

Comments
 (0)