Skip to content

Commit 8e2c74a

Browse files
committed
ci: fix workflow-linter self-flag bug
The old `grep -rn "uses:"` matched the check's own source line in workflow-linter.yml itself, producing a false-positive "unpinned action" failure on every PR. Replace with gitbot-fleet's fixed version (anchored regex: `grep -rnE "^[[:space:]]+uses:"`).
1 parent d6f1d86 commit 8e2c74a

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

.github/workflows/workflow-linter.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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:
@@ -36,7 +37,7 @@ jobs:
3637
fi
3738
done
3839
if [ $failed -eq 1 ]; then
39-
echo "Add '# SPDX-License-Identifier: AGPL-3.0-or-later' as first line"
40+
echo "Add '# SPDX-License-Identifier: PMPL-1.0' as first line"
4041
exit 1
4142
fi
4243
echo "All workflows have SPDX headers"
@@ -53,7 +54,8 @@ jobs:
5354
fi
5455
done
5556
if [ $failed -eq 1 ]; then
56-
echo "Add 'permissions: read-all' at workflow level"
57+
echo "Add 'permissions:
58+
contents: read' at workflow level"
5759
exit 1
5860
fi
5961
echo "All workflows have permissions declared"
@@ -63,7 +65,7 @@ jobs:
6365
echo "=== Checking Action Pinning ==="
6466
# Find any uses: lines that don't have @SHA format
6567
# Pattern: uses: owner/repo@<40-char-hex>
66-
unpinned=$(grep -rn "uses:" .github/workflows/ | \
68+
unpinned=$(grep -rnE "^[[:space:]]+uses:" .github/workflows/ | \
6769
grep -v "@[a-f0-9]\{40\}" | \
6870
grep -v "uses: \./\|uses: docker://\|uses: actions/github-script" || true)
6971
@@ -72,7 +74,7 @@ jobs:
7274
echo "$unpinned"
7375
echo ""
7476
echo "Replace version tags with SHA pins, e.g.:"
75-
echo " uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4.1.1"
77+
echo " uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.1"
7678
exit 1
7779
fi
7880
echo "All actions are SHA-pinned"

0 commit comments

Comments
 (0)