Skip to content

ci: cancel in-flight runs when a PR is converted to draft - #3033

Draft
goastler wants to merge 1 commit into
mainfrom
ci/cancel-on-draft
Draft

ci: cancel in-flight runs when a PR is converted to draft#3033
goastler wants to merge 1 commit into
mainfrom
ci/cancel-on-draft

Conversation

@goastler

Copy link
Copy Markdown
Member

Same change as https://github.com/prosopo/captcha-private/pull/4113, applied here.

Adds converted_to_draft to the pull_request types of the nine PR-triggered workflows. Every one of them already has concurrency: cancel-in-progress: true, and that is what does the cancelling — a job-level if cannot stop a run that is already going. Adding the trigger type means a new run is created, claims the group, and evicts the in-flight one; the jobs then skip, so the new run costs nothing.

Seven of the nine need no new condition: they already gate on github.event.pull_request.draft == false, and on a converted_to_draft event the PR is draft, so they skip on their own. Two gate on something else and got an explicit github.event.action != 'converted_to_draft':

  • changesets.yml (gates on the PR title)
  • dependabot-changeset.yml (gates on the actor)

Out of scope: tag_release.yml (closed only) and release.yml.

Not verifiable from a draft PR — to prove it, convert a throwaway non-draft PR to draft while a run is in flight and watch the run get cancelled.

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.

1 participant