]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
CI: Cancel obsolete concurrent GitHub Actions workflow jobs (#1940)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Mon, 11 Nov 2024 18:24:25 +0000 (18:24 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 11 Nov 2024 23:06:37 +0000 (23:06 +0000)
If a new push happens to a staging branch or a PR branch, continuing to
run now-obsolete tests is pointless and wasteful. However, we do want to
finish any jobs running on previous master branch commits, so that every
master branch commit has full test results.

.github/workflows/quick.yaml
.github/workflows/slow.yaml

index affa40466bbec8a58d99e3958fae4171ab09778a..aad03461d4a26379b463351c7521e8ad48d9c9b0 100644 (file)
@@ -16,6 +16,12 @@ on:
     # test PRs targeting this branch code
     branches: [ "master" ]
 
+concurrency:
+  # Cancel ongoing tests in case of push to the same PR or staging branch,
+  # but let previous master commit tests complete.
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}
+
 env:
   # empty except for pull_request events
   PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
index 6604bb9ec0bc1f112030a69d1c7bc6e219b7b213..0d60fa04ed19540576ba84591df938fe0301245b 100644 (file)
@@ -14,6 +14,11 @@ on:
   push:
     branches: [ "auto" ]
 
+concurrency:
+  # Cancel ongoing tests in case of push to staging branch.
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
 jobs:
   linux-distros: