Skip to content

Commit

Permalink
CI: Cancel obsolete concurrent GitHub Actions workflow jobs (#1940)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kinkie authored and squid-anubis committed Nov 11, 2024
1 parent cb1a70e commit c4673f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/quick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/slow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down

0 comments on commit c4673f1

Please sign in to comment.