Skip to content

Commit b68f7ca

Browse files
committed
Fix workflow
1 parent 35b58aa commit b68f7ca

File tree

3 files changed

+54
-25
lines changed

3 files changed

+54
-25
lines changed

.github/workflows/update-go-dep.yml

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,30 @@ jobs:
1111
update_golang_deps:
1212
name: Update Golang Dependencies
1313
runs-on: ubuntu-latest
14+
env:
15+
GOPRIVATE_KEY: ${{ secrets.XDT_REPO_ACCESS_KEY }}
16+
GOPRIVATE: "github.com/ease-lab/vhive-xdt"
1417
steps:
18+
19+
- name: Checkout code into go module directory
20+
uses: actions/checkout@v4
21+
1522
- name: Set up Go
1623
uses: actions/setup-go@v5
1724
with:
18-
go-version: 1.21
25+
go-version: '1.21'
1926

20-
- name: Check out code
21-
uses: actions/checkout@v4
22-
with:
23-
ref: main
27+
- run: git config --global url."https://ease-lab:$(echo $GOPRIVATE_KEY)@github.com/ease-lab/vhive-xdt".insteadOf "https://github.com/ease-lab/vhive-xdt"
2428

2529
- name: Find all go.mod files
30+
shell: bash
2631
run: |
27-
PATHS=$(find . -type f -name go.mod -printf '%h ')
28-
29-
30-
- name: Upgrade the Golang Dependencies for all mod files
31-
id: detect-and-update
32-
run: |
33-
34-
for p in $PATHS;
35-
do
36-
37-
echo "Update dependencies in $p"
38-
go get -u ./...
39-
40-
output=$(git status -s)
41-
if [ -z "${output}" ]; then
42-
exit 0
43-
fi
44-
45-
go mod tidy
46-
done
32+
./utils/update_go_dependencies.sh
4733
4834
- name: Create Pull Request
4935
uses: peter-evans/create-pull-request@v6
5036
with:
37+
token: ${{ secrets.ENABLE_AUTOMERGE_TOKEN }}
5138
branch: "upgrade-go-deps-on-main"
5239
commit-message: "Upgrade go deps"
5340
signoff: true

utils/install_go.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,6 @@ export PATH=$PATH:/usr/local/go/bin
4040
sudo sh -c "echo 'export PATH=\$PATH:/usr/local/go/bin' >> /etc/profile"
4141
sh -c "echo 'export PATH=\$PATH:/usr/local/go/bin' >> $HOME/.bashrc"
4242

43+
rm ${GO_BUILD}.tar.gz
44+
4345
echo "Installed: $(go version)"

utils/update_go_dependencies.sh

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/bash
2+
3+
# MIT License
4+
#
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
24+
set -e
25+
26+
PATHS=$(find . -type f -name go.mod -printf '%h ')
27+
28+
for p in $PATHS;
29+
do
30+
31+
pushd $p
32+
33+
echo "Update dependencies in $p"
34+
go get -u ./... || true
35+
36+
go mod tidy || true
37+
38+
popd
39+
40+
done

0 commit comments

Comments
 (0)