Skip to content

ci: cancel superseded pull request runs - #1315

Open
NopeCharon wants to merge 1 commit into
eraser-dev:mainfrom
NopeCharon:ci/add-concurrency
Open

NopeCharon wants to merge 1 commit into
eraser-dev:mainfrom
NopeCharon:ci/add-concurrency

Conversation

@NopeCharon

Copy link
Copy Markdown

What this PR does / why we need it:

None of the workflows that run on pull requests set concurrency. When a new commit is pushed to a PR, the runs for the old commit keep going next to the new ones. For test and upgrade, that's a full set of image builds and e2e matrix jobs spent on a commit nobody will look at.

This adds a workflow-level concurrency group to test, upgrade, deploy_docs and dep-review:

concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
  cancel-in-progress: true
  • Runs for the same pull request share a group, so a new push cancels the run it replaces.
  • Events without a pull request (pushes, including to main, and the docs deployment) fall back to github.run_id. Each of those gets its own group, so it is never queued behind or cancelled by another run. Post-merge main runs and GitHub Pages deploys behave exactly as before.

The reusable workflows (build-id, e2e-build, e2e-test) are left alone because they run inside the caller's group. Workflows that don't run on pull requests are unchanged.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):
Fixes #857

Special notes for your reviewer:

The four changed workflows pass actionlint v1.7.7.

None of the workflows that run on pull requests set a concurrency
group, so pushing a new commit to a pull request left the runs for the
previous commit going alongside the new ones. For test and upgrade that
means a full set of image builds and e2e test matrices burning
runner time for a commit nobody will look at.

Give test, upgrade, deploy_docs and dep-review a concurrency group
keyed on the pull request number with cancel-in-progress, so a new push
cancels the run it replaces. Events without a pull request (pushes,
including to main, and the docs deployment) fall back to the run ID, so
each of those keeps a group of its own and is never queued behind or
cancelled by another run.

Fixes eraser-dev#857

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI: Add concurrency on actions ran on PRs

1 participant