-
Notifications
You must be signed in to change notification settings - Fork 7
40 lines (38 loc) · 1.03 KB
/
tidy.yml
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
# Credit: https://github.com/crazy-max/diun
name: auto-go-mod-tidy
on:
push:
branches:
- 'dependabot/**'
jobs:
fix:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3.1.0
-
# https://github.com/actions/checkout/issues/6
name: Fix detached HEAD
run: git checkout ${GITHUB_REF#refs/heads/}
-
name: Tidy
run: |
rm -f go.sum
go mod tidy
-
name: Set up Git
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
-
name: Commit and push changes
run: |
git add .
if output=$(git status --porcelain) && [ ! -z "$output" ]; then
git commit -m 'Fix go modules'
git push
fi