Skip to content

Commit 33a861d

Browse files
authored
Update check (#231)
* Update check * Added test * Change paths
1 parent 4962f3c commit 33a861d

File tree

5 files changed

+620
-19
lines changed

5 files changed

+620
-19
lines changed

.github/workflows/test.yaml

Lines changed: 62 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,71 @@
1-
name: test
2-
on: [push]
1+
name: Update Dependencies and Test
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
push:
7+
branches:
8+
- main
9+
paths:
10+
- 'go.mod'
11+
- 'go.sum'
12+
- '**.go'
13+
314
jobs:
4-
test:
5-
name: Test
15+
update-deps:
616
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
721
steps:
8-
- name: Set up Go 1.22.0
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
ref: ${{ github.head_ref }}
26+
27+
- name: Set up Go
928
uses: actions/setup-go@v5
1029
with:
11-
go-version: 1.22.0
12-
13-
- name: Check out code into the Go module directory
14-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
30+
go-version: '1.21'
31+
cache: true
32+
33+
- name: Run go mod tidy
34+
run: go mod tidy
35+
36+
- name: Check for changes
37+
id: git-check
38+
run: |
39+
if [[ -n $(git status --porcelain) ]]; then
40+
echo "changes=true" >> $GITHUB_OUTPUT
41+
else
42+
echo "changes=false" >> $GITHUB_OUTPUT
43+
fi
1544
16-
- name: Go mod tidy check
17-
run: go mod tidy && git diff --exit-code
45+
- name: Commit and push if changed
46+
if: steps.git-check.outputs.changes == 'true'
47+
run: |
48+
git config --global user.name 'github-actions[bot]'
49+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
50+
git add go.mod go.sum
51+
git commit -m "chore(deps): update dependencies with go mod tidy"
52+
git push
1853
19-
- name: Get dependencies
20-
run: go get -v -t -d ./...
54+
test:
55+
needs: update-deps
56+
runs-on: ubuntu-latest
57+
58+
steps:
59+
- uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0
62+
ref: ${{ github.head_ref }}
63+
64+
- name: Set up Go
65+
uses: actions/setup-go@v5
66+
with:
67+
go-version: '1.21'
68+
cache: true
2169

22-
- name: Execute test
70+
- name: Run tests
2371
run: make test

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
.idea/**/usage.statistics.xml
3434
.idea/**/dictionaries
3535
.idea/**/shelf
36-
36+
.idea/codeStyles
3737
# Generated files
3838
.idea/**/contentModel.xml
3939

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ toolchain go1.23.3
77
require (
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

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI
8080
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8181
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
8282
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
83-
github.com/slack-go/slack v0.15.0 h1:LE2lj2y9vqqiOf+qIIy0GvEoxgF1N5yLGZffmEZykt0=
84-
github.com/slack-go/slack v0.15.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw=
83+
github.com/slack-go/slack v0.16.0 h1:khp/WCFv+Hb/B/AJaAwvcxKun0hM6grN0bUZ8xG60P8=
84+
github.com/slack-go/slack v0.16.0/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw=
8585
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
8686
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
8787
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

0 commit comments

Comments
 (0)