From b6d3040c6853ebd69da7623a3b6afd8555d5b90f Mon Sep 17 00:00:00 2001 From: Ernesto Puerta Date: Tue, 23 Jan 2024 19:44:26 +0100 Subject: [PATCH] ci: cancel CI run when another starts When a user pushes a change to a PR, if there was an ongoing CI run, this will cancel any previous runs. This will save some CO2. Signed-off-by: Ernesto Puerta --- .github/workflows/build-container.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index b58f2c3a..caaedd19 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -14,6 +14,10 @@ on: # yamllint disable rule:truthy release: types: - created +# Credit: https://stackoverflow.com/a/72408109 +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true env: WAIT_INTERVAL_SECS: 1 jobs: