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 1
1
#! /usr/bin/env bash
2
2
set -euo pipefail
3
3
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
-
23
4
MOD_VERSION=$( go mod edit -json | jq -r .Go)
24
5
echo " go.mod version: $MOD_VERSION "
25
6
STATUS=0
26
7
27
- if [[ $fix -eq 1 ]]; then
8
+ if [[ " $* " == * " --fix " * ]]; then
28
9
for wf in .github/workflows/* .{yml,yaml}; do
29
10
sed -i " s/go-version:.*/go-version: \" ${MOD_VERSION} \" /g" " ${wf} "
30
11
done
31
- exit $STATUS
12
+ exit 0
32
13
fi
33
14
34
15
for wf in .github/workflows/* .{yml,yaml}; do
@@ -37,9 +18,9 @@ for wf in .github/workflows/*.{yml,yaml}; do
37
18
continue
38
19
fi
39
20
40
- UNIQUE_WF_VERSIONS=$( echo " $WF_VERSIONS " | sort -u )
21
+ UNIQUE_WF_VERSIONS=$( sort -u <<< " $WF_VERSIONS" )
41
22
for ver in $UNIQUE_WF_VERSIONS ; do
42
- if [[ " ${ ver} " != " $MOD_VERSION " ]]; then
23
+ if [[ $ ver != " $MOD_VERSION " ]]; then
43
24
STATUS=1
44
25
echo " ❌ $wf : go.mod=$MOD_VERSION but workflow uses $( tr ' \n' ' ' <<< " $UNIQUE_WF_VERSIONS" ) "
45
26
continue
You can’t perform that action at this time.
0 commit comments