File tree Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Expand file tree Collapse file tree 1 file changed +10
-18
lines changed Original file line number Diff line number Diff line change @@ -3,30 +3,22 @@ set -euo pipefail
33
44MOD_VERSION=$( go mod edit -json | jq -r .Go)
55echo " go.mod version: $MOD_VERSION "
6+ STATUS=0
67
78for wf in .github/workflows/* .yml; do
8- echo " Checking $wf ..."
9-
109 WF_VERSIONS=$( yq -r ' .jobs[].steps[] | select(.with["go-version"]) | .with["go-version"]' -o=tsv " $wf " | grep -v ' ^---$' || true)
11- if [ -z " $WF_VERSIONS " ]; then
12- echo " ℹ️ No go-version found in $wf (skipped)"
10+ if [[ -z " $WF_VERSIONS " ]]; then
1311 continue
1412 fi
1513
1614 UNIQUE_WF_VERSIONS=$( echo " $WF_VERSIONS " | sort -u)
17- if [ " $( echo " $UNIQUE_WF_VERSIONS " | wc -l) " -ne 1 ]; then
18- echo " ❌ Multiple Go versions found in $wf :"
19- echo " $UNIQUE_WF_VERSIONS "
20- exit 1
21- fi
22-
23- # At this point there's only one unique Go version
24- if [ " $UNIQUE_WF_VERSIONS " != " $MOD_VERSION " ]; then
25- echo " ❌ Mismatch in $wf : go.mod=$MOD_VERSION but workflow uses $UNIQUE_WF_VERSIONS "
26- exit 1
27- fi
28-
29- echo " ✅ $wf matches go.mod ($MOD_VERSION )"
15+ for ver in $UNIQUE_WF_VERSIONS ; do
16+ if [[ " ${ver} " != " $MOD_VERSION " ]]; then
17+ STATUS=1
18+ echo " ❌ $wf : go.mod=$MOD_VERSION but workflow uses $( tr ' \n' ' ' <<< " $UNIQUE_WF_VERSIONS" ) "
19+ continue
20+ fi
21+ done
3022done
3123
32- echo " ✅ All workflows consistent with go.mod ( $MOD_VERSION ) "
24+ exit $STATUS
You can’t perform that action at this time.
0 commit comments