2021-07-12 23:02:45 +01:00
|
|
|
name: go generate
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- "release-branch/*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "*"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Set up Go
|
2022-03-16 19:46:16 +00:00
|
|
|
uses: actions/setup-go@v3
|
2021-07-12 23:02:45 +01:00
|
|
|
with:
|
2022-08-02 19:34:03 +01:00
|
|
|
go-version: 1.19
|
2021-07-12 23:02:45 +01:00
|
|
|
|
|
|
|
- name: Check out code
|
2022-03-22 22:56:34 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-07-12 23:02:45 +01:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: check 'go generate' is clean
|
|
|
|
run: |
|
2022-04-13 21:49:18 +01:00
|
|
|
if [[ "${{github.ref}}" == release-branch/* ]]
|
|
|
|
then
|
|
|
|
pkgs=$(go list ./... | grep -v dnsfallback)
|
|
|
|
else
|
|
|
|
pkgs=$(go list ./... | grep -v dnsfallback)
|
|
|
|
fi
|
|
|
|
go generate $pkgs
|
2021-07-12 23:02:45 +01:00
|
|
|
echo
|
|
|
|
echo
|
|
|
|
git diff --name-only --exit-code || (echo "The files above need updating. Please run 'go generate'."; exit 1)
|