@@ -14,16 +14,34 @@ if [[ ${DEBUG:-false} == "true" ]]; then
1414 set -o xtrace
1515fi
1616
17+ trap " make fmt" EXIT
18+
1719eval " $( curl -fsSL https://raw.githubusercontent.com/electrocucaracha/pkg-mgr_scripts/master/ci/pinned_versions.env) "
1820
1921sed -i " s|PKG_VAGRANT_VERSION:-.*|PKG_VAGRANT_VERSION:-$PKG_VAGRANT_VERSION }|g" setup.sh
2022sed -i " s/vagrant version.*/vagrant version | awk 'NR==1\{print \$ 3}')\" != \" $PKG_VAGRANT_VERSION \" \]\]; then/g" validate.sh
2123
24+ go_version=" $( curl -sL https://golang.org/VERSION? m=text | sed -n ' s/go//;s/\..$//;1p' ) "
25+ find .github/workflows -type f \( -name ' *.yml' -o -name ' *.yaml' \) \
26+ -exec grep -l ' go-version:' {} + \
27+ -exec env go_version=" ${go_version} " bash -s {} + << 'EOF '
28+ for file; do
29+ sed -i \
30+ "s|^\([[:space:]]*go-version:[[:space:]]*\).*|\
31+ \1\"^${go_version}\"|" \
32+ "${file}"
33+ done
34+ EOF
35+
2236# Update GitHub Action commit hashes
23- gh_actions=$( grep -r " uses: [a-zA-Z\-]*/[\_a-z\-]*@" .github/ | sed ' s/@.*//' | awk -F ' : ' ' { print $3 }' | sort -u)
37+ gh_actions=$( grep -r " uses: [A-Za-z0-9_.-]*/[\_a-z\-]*@" .github/ | sed ' s/@.*//' | awk -F ' : ' ' { print $3 }' | sort -u)
38+ exceptions=(' reviewdog/action-misspell' ' actions/attest-build-provenance' ' GrantBirki/git-diff-action' )
2439for action in $gh_actions ; do
25- commit_hash=$( git ls-remote " https://github.com/$action " | grep ' refs/tags/[v]\?[0-9][0-9\.]*$' | sed ' s|refs/tags/[vV]\?[\.]\?||g' | sort -u -k2 -V | tail -1 | awk ' { printf "%s # %s\n",$1,$2 }' )
40+ if [[ ${exceptions[*]} =~ (^| [^[:alpha:]])$action ([^[:alpha:]]| $) ]]; then
41+ commit_hash=$( git ls-remote " https://github.com/$action " | grep ' refs/tags/[v]\?[0-9][0-9\.]*\^{}$' | sed ' s|refs/tags/[vV]\?[\.]\?||g; s|\^{}$||g' | sort -u -k2 -V | tail -1 | awk ' { printf "%s # %s\n",$1,$2 }' )
42+ else
43+ commit_hash=$( git ls-remote " https://github.com/$action " | grep ' refs/tags/[v]\?[0-9][0-9\.]*$' | sed ' s|refs/tags/[vV]\?[\.]\?||g' | sort -u -k2 -V | tail -1 | awk ' { printf "%s # %s\n",$1,$2 }' )
44+ fi
2645 # shellcheck disable=SC2267
2746 grep -ElRZ " uses: $action @" .github/ | xargs -0 -l sed -i -e " s|uses: $action @.*|uses: $action @$commit_hash |g"
2847done
29- make fmt
0 commit comments