File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 66 - main
77
88jobs :
9+ static-code-checks :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ with :
14+ fetch-depth : 0
15+
16+ - name : Check for versioned GitHub actions
17+ if : always()
18+ run : |
19+ # Get changed GitHub workflow/action files
20+ CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}..HEAD | grep -E "^\.github/(workflows|actions)/.*\.ya?ml$" || true)
21+
22+ if [ -n "$CHANGED_FILES" ]; then
23+ # Check for any versioned actions, excluding comments and this validation script
24+ VIOLATIONS=$(grep -Hn "uses:.*@v" $CHANGED_FILES | grep -v "grep.*uses:.*@v" | grep -v "#.*@v" || true)
25+ if [ -n "$VIOLATIONS" ]; then
26+ echo "Found versioned GitHub actions. Use commit SHAs instead:"
27+ echo "$VIOLATIONS"
28+ exit 1
29+ fi
30+ fi
31+
32+ echo "No versioned actions found in changed files"
33+
934 build :
1035 name : Gradle Build
1136 runs-on : ubuntu-latest
You can’t perform that action at this time.
0 commit comments