Skip to content

Commit bc32427

Browse files
authored
Fix go.mod replace by CI (#1241)
* Fix go.mod replace by CI * Fix
1 parent 3290e45 commit bc32427

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.github/workflows/go.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,15 @@ jobs:
2525
with:
2626
go-version-file: go.mod
2727
cache-dependency-path: go.sum
28+
29+
fix-go-mod-replace:
30+
runs-on: ubuntu-latest
31+
timeout-minutes: 10
32+
steps:
33+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
- uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
35+
with:
36+
go-version-file: go.mod
37+
cache-dependency-path: go.sum
38+
- run: bash hack/fix_go_mod_replace.sh
39+
- uses: int128/update-generated-files-action@65b9a7ae3ededc5679d78343f58fbebcf1ebd785 # v2.57.0

hack/fix_go_mod_replace.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -eux -o pipefail
3+
4+
argocd_version="$(grep -m1 github.com/argoproj/argo-cd/v2 go.mod | awk '{print $2}')"
5+
[ "${argocd_version}" ]
6+
go get "github.com/argoproj/argo-cd/v2@${argocd_version}"
7+
8+
k8s_version="$(grep -m1 k8s.io/api go.mod | awk '{print $2}')"
9+
[ "${k8s_version}" ]
10+
perl -i -pne "s/(k8s.io\/\S+ => k8s.io\/\S+) .+$/\1 ${k8s_version}/g" go.mod

0 commit comments

Comments
 (0)