Skip to content

Commit

Permalink
Add concurrency group for CI jobs
Browse files Browse the repository at this point in the history
As it stands, an arbitrary number of CI jobs can be running for a given
pull request, which means that sometimes the CI will be running for a
commit that has been superceded by several newer commits. Adding a
concurrency group to the CI jobs allows GitHub to automatically cancel
old jobs if a new commit is pushed that makes the run obsolete.
  • Loading branch information
stephenswat committed Jul 4, 2023
1 parent 76b9c9d commit 4d8792c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
branches:
- main

# Cancel existing jobs on new pushes.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

# All the different build/test jobs.
jobs:

Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: Checks

# Cancel existing jobs on new pushes.
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

on:
push:
pull_request:
Expand Down

0 comments on commit 4d8792c

Please sign in to comment.