File tree Expand file tree Collapse file tree 1 file changed +54
-0
lines changed
Expand file tree Collapse file tree 1 file changed +54
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Update Dependencies
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+ paths :
7+ - ' go.mod'
8+ - ' go.sum'
9+ push :
10+ branches :
11+ - main
12+ paths :
13+ - ' go.mod'
14+ - ' go.sum'
15+
16+ jobs :
17+ update-deps :
18+ runs-on : ubuntu-latest
19+ permissions :
20+ contents : write
21+ pull-requests : write
22+
23+ steps :
24+ - uses : actions/checkout@v4
25+ with :
26+ fetch-depth : 0
27+ ref : ${{ github.head_ref }}
28+
29+ - name : Set up Go
30+ uses : actions/setup-go@v5
31+ with :
32+ go-version : ' 1.21'
33+ cache : true
34+
35+ - name : Run go mod tidy
36+ run : go mod tidy
37+
38+ - name : Check for changes
39+ id : git-check
40+ run : |
41+ if [[ -n $(git status --porcelain) ]]; then
42+ echo "changes=true" >> $GITHUB_OUTPUT
43+ else
44+ echo "changes=false" >> $GITHUB_OUTPUT
45+ fi
46+
47+ - name : Commit and push if changed
48+ if : steps.git-check.outputs.changes == 'true'
49+ run : |
50+ git config --global user.name 'github-actions[bot]'
51+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
52+ git add go.mod go.sum
53+ git commit -m "chore(deps): update dependencies with go mod tidy"
54+ git push
You can’t perform that action at this time.
0 commit comments