-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (72 loc) · 2.59 KB
/
Copy pathtools.yml
File metadata and controls
84 lines (72 loc) · 2.59 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
---
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
name: tools
"on":
workflow_dispatch:
schedule:
- cron: "0 8 * * 1"
permissions:
contents: write
pull-requests: write
jobs:
tools:
runs-on: ubuntu-latest
steps:
- name: Generate token
id: token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.TOKEN_EXCHANGE_APP }}
private-key: ${{ secrets.TOKEN_EXCHANGE_KEY }}
permission-contents: write
permission-pull-requests: write
permission-issues: write
- name: Checkout source
uses: actions/checkout@v7
with:
token: ${{ steps.token.outputs.token }}
fetch-depth: 0
- name: Setup golang
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Update golangci
run: |
TOOL="github.com/golangci/golangci-lint/v2/cmd/golangci-lint"
MOD="$(go list -mod=readonly -f '{{.Module.Path}}' ${TOOL})"
VERSION="$(go list -mod=readonly -u -json -m ${MOD} | jq -r .Update.Version)"
if [[ "${VERSION}" != "null" ]]; then
go get -tool "${TOOL}@${VERSION}" && go mod tidy
fi
- name: Update revive
run: |
TOOL="github.com/mgechev/revive"
MOD="$(go list -mod=readonly -f '{{.Module.Path}}' ${TOOL})"
VERSION="$(go list -mod=readonly -u -json -m ${MOD} | jq -r .Update.Version)"
if [[ "${VERSION}" != "null" ]]; then
go get -tool "${TOOL}@${VERSION}" && go mod tidy
fi
- name: Create request
id: request
uses: peter-evans/create-pull-request@v8
with:
branch: update/tools
delete-branch: true
committer: "GitHub Actions <github@webhippie.de>"
commit-message: "ci: automated tool updates"
signoff: true
title: "ci: automated tool updates"
body: "New versions updated, automerge should handle that!"
labels: tools
token: ${{ steps.token.outputs.token }}
- name: Approve request
if: steps.request.outputs.pull-request-operation == 'created'
run: gh pr review --approve "${{ steps.request.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Enable automerge
if: steps.request.outputs.pull-request-operation == 'created'
run: gh pr merge --rebase --auto "${{ steps.request.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
...