From 6fcc8727f5c14c28b988b4755f6ee0ebbbefd18d Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Sun, 26 Feb 2023 22:36:33 +0100 Subject: [PATCH] Change: [Actions] cancel previous run if pushing new PR Lately we had a few times that people pushed to their PR branch a few times to make small changes. Sadly, this triggers all CIs every time, which takes ~20 minutes. As we are limited in the amount of runners we get assigned to us, this means all other CI, even for other repositories within OpenTTD, are delayed too. We can avoid this by simply cancelling old runs when a new PR is pushed. There is a downside: sometimes people already push a new commit, but still want to know if the old one passed. That will no longer be possible with this change. --- .github/workflows/ci-build.yml | 4 ++++ .github/workflows/codeql.yml | 4 ++++ .github/workflows/commit-checker.yml | 4 ++++ .github/workflows/unused-strings.yml | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index e5b0947315..a9c868242e 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -9,6 +9,10 @@ on: env: CTEST_OUTPUT_ON_FAILURE: 1 +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + jobs: emscripten: name: Emscripten diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 153a4706c7..936c4c92d7 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -9,6 +9,10 @@ on: branches: - master +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + jobs: analyze: name: Analyze diff --git a/.github/workflows/commit-checker.yml b/.github/workflows/commit-checker.yml index 91fc54b104..1407757fc5 100644 --- a/.github/workflows/commit-checker.yml +++ b/.github/workflows/commit-checker.yml @@ -3,6 +3,10 @@ name: Commit checker on: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + jobs: commit-checker: name: Commit checker diff --git a/.github/workflows/unused-strings.yml b/.github/workflows/unused-strings.yml index 6026671307..08a0cb26e7 100644 --- a/.github/workflows/unused-strings.yml +++ b/.github/workflows/unused-strings.yml @@ -3,6 +3,10 @@ name: Unused strings on: pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + jobs: unused-strings: name: Unused strings