2021-07-12 22:02:45 +00:00
|
|
|
name: go generate
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
- "release-branch/*"
|
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- "*"
|
|
|
|
|
2022-08-15 05:43:07 +00:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2021-07-12 22:02:45 +00:00
|
|
|
jobs:
|
|
|
|
check:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Check out code
|
2022-03-22 22:56:34 +00:00
|
|
|
uses: actions/checkout@v3
|
2021-07-12 22:02:45 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2022-08-30 11:41:08 +00:00
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v3
|
|
|
|
with:
|
|
|
|
go-version-file: go.mod
|
|
|
|
|
2021-07-12 22:02:45 +00:00
|
|
|
- name: check 'go generate' is clean
|
|
|
|
run: |
|
2022-04-13 20:49:18 +00: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 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)
|