2021-07-12 22:02:45 +00:00
|
|
|
name: go generate
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- "release-branch/*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "*"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go
|
2021-09-22 22:36:01 +00:00
|
|
|
uses: actions/setup-go@v2.1.4
|
2021-07-12 22:02:45 +00:00
|
|
|
with:
|
2021-09-02 19:28:03 +00:00
|
|
|
go-version: 1.17
|
2021-07-12 22:02:45 +00:00
|
|
|
|
|
|
|
- name: Check out code
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: check 'go generate' is clean
|
|
|
|
run: |
|
2021-09-15 17:16:11 +00:00
|
|
|
if [[ "${{github.ref}}" == release-branch/* ]]
|
|
|
|
then
|
|
|
|
pkgs=$(go list ./... | grep -v dnsfallback)
|
|
|
|
else
|
2021-10-14 20:56:08 +00:00
|
|
|
pkgs=$(go list ./... | grep -v dnsfallback)
|
2021-09-15 17:16:11 +00:00
|
|
|
fi
|
2021-09-15 18:58:08 +00:00
|
|
|
go generate $pkgs
|
2021-07-12 22:02:45 +00:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
git diff --name-only --exit-code || (echo "The files above need updating. Please run 'go generate'."; exit 1)
|