mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-26 11:35:35 +00:00
d4916a8be3
Currently scheduled runs are not canceled when we update PRs, those results are unused and the resources are just wasted. Instead of doing that, this PR makes it so that when a PR is updated (force-pushed or new commit added) the previous runs are canceled. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-a-fallback-value Signed-off-by: Maisem Ali <maisem@tailscale.com>
43 lines
947 B
YAML
43 lines
947 B
YAML
name: go generate
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- "release-branch/*"
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19
|
|
|
|
- name: Check out code
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: check 'go generate' is clean
|
|
run: |
|
|
if [[ "${{github.ref}}" == release-branch/* ]]
|
|
then
|
|
pkgs=$(go list ./... | grep -v dnsfallback)
|
|
else
|
|
pkgs=$(go list ./... | grep -v dnsfallback)
|
|
fi
|
|
go generate $pkgs
|
|
echo
|
|
echo
|
|
git diff --name-only --exit-code || (echo "The files above need updating. Please run 'go generate'."; exit 1)
|