File tree Expand file tree Collapse file tree 1 file changed +4
-23
lines changed Expand file tree Collapse file tree 1 file changed +4
-23
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22set -euo pipefail
33
4- fix=0
5- args=" $( getopt -o " " -l fix -- " $@ " ) "
6- eval set -- " $args "
7- while true ; do
8- case " $1 " in
9- --fix)
10- fix=1
11- shift
12- ;;
13- --)
14- shift
15- break
16- ;;
17- * )
18- error " Unrecognized option: $1 "
19- ;;
20- esac
21- done
22-
234MOD_VERSION=$( go mod edit -json | jq -r .Go)
245echo " go.mod version: $MOD_VERSION "
256STATUS=0
267
27- if [[ $fix -eq 1 ]]; then
8+ if [[ " $* " == * " --fix " * ]]; then
289 for wf in .github/workflows/* .{yml,yaml}; do
2910 sed -i " s/go-version:.*/go-version: \" ${MOD_VERSION} \" /g" " ${wf} "
3011 done
31- exit $STATUS
12+ exit 0
3213fi
3314
3415for wf in .github/workflows/* .{yml,yaml}; do
@@ -37,9 +18,9 @@ for wf in .github/workflows/*.{yml,yaml}; do
3718 continue
3819 fi
3920
40- UNIQUE_WF_VERSIONS=$( echo " $WF_VERSIONS " | sort -u )
21+ UNIQUE_WF_VERSIONS=$( sort -u <<< " $WF_VERSIONS" )
4122 for ver in $UNIQUE_WF_VERSIONS ; do
42- if [[ " ${ ver} " != " $MOD_VERSION " ]]; then
23+ if [[ $ ver != " $MOD_VERSION " ]]; then
4324 STATUS=1
4425 echo " ❌ $wf : go.mod=$MOD_VERSION but workflow uses $( tr ' \n' ' ' <<< " $UNIQUE_WF_VERSIONS" ) "
4526 continue
You can’t perform that action at this time.
0 commit comments