Skip to content

Commit

Permalink
Cancel running GHA workflows on pushes to the same branch (#1090)
Browse files Browse the repository at this point in the history
When a new push happens on a PR in github it will cancel
the previous workflows. This will free up more resources
for other PRs.
  • Loading branch information
allada authored Jul 7, 2024
1 parent a3bd7d9 commit 545f752
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
analyze:
name: Analyze
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
publish-image:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/lre.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
local:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
nativelink-dot-com-build-on-main-test:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/native-bazel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
unit-tests:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/native-cargo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
cargo-native:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
nix-bazel:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
pre-commit-checks:
runs-on: ubuntu-22.04
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sanitizers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
sanitized-tests:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/scorecard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
analysis:
name: Scorecard analysis
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/tagged_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
publish-image:
strategy:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/vale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on: [pull_request]

permissions: read-all

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}

jobs:
vale:
name: vale
Expand Down

0 comments on commit 545f752

Please sign in to comment.