From fd8156991556706f776c508c373224b54ef4e14f Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Tue, 7 Dec 2021 22:03:04 -0800 Subject: [PATCH] chore: github workflow: cancel prior running jobs on new push If new new push is done to a pull-request, then cancel any already running github workflow jobs in order to conserve resources. --- .github/workflows/docs.yml | 6 ++++++ .github/workflows/lint.yml | 6 ++++++ .github/workflows/pre_commit.yml | 6 ++++++ .github/workflows/test.yml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0dce8591e..c635be4cc 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,5 +1,11 @@ name: Docs +# If a pull-request is pushed then cancel all previously running jobs related +# to that pull-request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + on: push: branches: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 259cd7186..840909dcf 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,5 +1,11 @@ name: Lint +# If a pull-request is pushed then cancel all previously running jobs related +# to that pull-request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + on: push: branches: diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml index 87f6387d6..d109e5d6a 100644 --- a/.github/workflows/pre_commit.yml +++ b/.github/workflows/pre_commit.yml @@ -1,5 +1,11 @@ name: pre_commit +# If a pull-request is pushed then cancel all previously running jobs related +# to that pull-request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + on: push: branches: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62c2221c0..d13f6006b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,5 +1,11 @@ name: Test +# If a pull-request is pushed then cancel all previously running jobs related +# to that pull-request +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} + cancel-in-progress: true + on: push: branches: