Skip to content

Commit

Permalink
ci: Cancel running workflows if retriggered
Browse files Browse the repository at this point in the history
For rationale, see
<https://turso.tech/blog/simple-trick-to-save-environment-and-money-when-using-github-actions>.

For the linting & formatting action, the concurrency group is set to
contain the PR (if any) and ref otherwise, on the basis that only the
latest push to a PR or branch is interesting.

For the GitHub Pages and Godot Asset Library actions, each run
overwrites the result of any previous run, so the concurrency group is
just the workflow name.
  • Loading branch information
wjt committed Nov 11, 2024
1 parent 95e95c6 commit 64e5962
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
branches:
- main

# Cancel any ongoing previous run if a PR is updated
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
pre-commit:
name: Linting and Formatting
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
types:
- published

# Cancel any ongoing previous run if the job is re-triggered
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

permissions:
contents: read
pages: write
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/godot-asset-library.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
types:
- published

# Cancel any ongoing previous run if the job is re-triggered
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

name: Push to Godot Asset Library

jobs:
Expand Down

0 comments on commit 64e5962

Please sign in to comment.