-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 1.95 KB
/
Copy pathgo_dependencies.yml
File metadata and controls
69 lines (59 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: Update Go dependencies
on:
schedule:
- cron: "0 0 * * 1" # Every Monday at 00:00 UTC
workflow_dispatch:
jobs:
update-deps:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Generate token
id: generate_token
uses: actions/create-github-app-token@v3
with:
client-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v7
with:
token: ${{ steps.generate_token.outputs.token }}
- uses: actions/setup-go@v6
with:
go-version: stable
cache: true
- name: Cache Go modules
uses: actions/cache@v6
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: Update dependencies
id: update
run: |
set -eo pipefail
go env GOPROXY
go get -u ./... 2>&1 | tee /tmp/go-get-output.txt
go mod tidy
# Build a summary of what changed in go.mod
CHANGES=$(git diff go.mod | grep '^[+-]' | grep -v '^[+-][+-][+-]' | grep -v '^[+-]module' | grep -v '^[+-]go ' || true)
echo "CHANGES<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v8
with:
token: ${{ steps.generate_token.outputs.token }}
branch: chore/update-go-deps
commit-message: "chore: go get -u && go mod tidy"
title: "chore: update Go dependencies"
body: |
## Dependency Updates
Automated update via `go get -u ./... && go mod tidy`.
### Changes to go.mod
```diff
${{ steps.update.outputs.CHANGES }}
```
labels: dependencies, go