-
Notifications
You must be signed in to change notification settings - Fork 36
33 lines (32 loc) · 891 Bytes
/
go-mod-tidy.yml
File metadata and controls
33 lines (32 loc) · 891 Bytes
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
name: go
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: "go mod tidy"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.21"
# Cache Go modules if go.sum is unchanged.
# Docs here: https://github.com/actions/cache/blob/9c7b3e90bdf39569c497c98e469f8a00e061c43f/examples.md#linux-1
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: check 'go mod tidy'
run: |
go mod tidy
echo
echo
git diff --name-only --exit-code || (echo "Please run 'go mod tidy'."; exit 1)