File tree Expand file tree Collapse file tree 2 files changed +67
-15
lines changed
Expand file tree Collapse file tree 2 files changed +67
-15
lines changed Original file line number Diff line number Diff line change 1- name : test
2- on : [push]
1+ name : Update Dependencies and Test
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+ paths :
7+ - ' go.mod'
8+ - ' go.sum'
9+ - ' **.go'
10+ push :
11+ branches :
12+ - main
13+ paths :
14+ - ' go.mod'
15+ - ' go.sum'
16+ - ' **.go'
17+
318jobs :
4- test :
5- name : Test
19+ update-deps :
620 runs-on : ubuntu-latest
21+ permissions :
22+ contents : write
23+ pull-requests : write
24+
725 steps :
8- - name : Set up Go 1.22.0
26+ - uses : actions/checkout@v4
27+ with :
28+ fetch-depth : 0
29+ ref : ${{ github.head_ref }}
30+
31+ - name : Set up Go
932 uses : actions/setup-go@v5
1033 with :
11- go-version : 1.22.0
12-
13- - name : Check out code into the Go module directory
14- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
34+ go-version : ' 1.21'
35+ cache : true
36+
37+ - name : Run go mod tidy
38+ run : go mod tidy
39+
40+ - name : Check for changes
41+ id : git-check
42+ run : |
43+ if [[ -n $(git status --porcelain) ]]; then
44+ echo "changes=true" >> $GITHUB_OUTPUT
45+ else
46+ echo "changes=false" >> $GITHUB_OUTPUT
47+ fi
1548
16- - name : Go mod tidy check
17- run : go mod tidy && git diff --exit-code
49+ - name : Commit and push if changed
50+ if : steps.git-check.outputs.changes == 'true'
51+ run : |
52+ git config --global user.name 'github-actions[bot]'
53+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
54+ git add go.mod go.sum
55+ git commit -m "chore(deps): update dependencies with go mod tidy"
56+ git push
1857
19- - name : Get dependencies
20- run : go get -v -t -d ./...
58+ test :
59+ needs : update-deps
60+ runs-on : ubuntu-latest
61+
62+ steps :
63+ - uses : actions/checkout@v4
64+ with :
65+ fetch-depth : 0
66+ ref : ${{ github.head_ref }}
67+
68+ - name : Set up Go
69+ uses : actions/setup-go@v5
70+ with :
71+ go-version : ' 1.21'
72+ cache : true
2173
22- - name : Execute test
74+ - name : Run tests
2375 run : make test
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ toolchain go1.23.3
77require (
88 github.com/DataDog/datadog-go v4.8.3+incompatible
99 github.com/Songmu/flextime v0.1.0
10- github.com/slack-go/slack v0.15 .0
10+ github.com/slack-go/slack v0.16 .0
1111 github.com/stretchr/testify v1.9.0
1212 github.com/thoas/go-funk v0.9.3
1313 k8s.io/api v0.28.4
You can’t perform that action at this time.
0 commit comments