ci: cancel duplicate PR runs to save runner resources#85
Open
maxholdaway wants to merge 2 commits into
Open
Conversation
Add workflow-level concurrency to every reusable workflow. PR pushes cancel any in-progress run for the same caller workflow + ref; pushes to main/release branches and tags are never cancelled (cancel-in-progress is gated on github.event_name == 'pull_request'). Group keys include a matrix-discriminating input where one exists (inputs.image, inputs.paths, inputs.dashboard-path, inputs.docker-project-name) so callers that matrix the same reusable workflow across multiple targets don't serialize on a shared slot. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🚨 gitStream Monthly Automation Limit Reached 🚨 Your organization has exceeded the number of pull requests allowed for automation with gitStream. To continue automating your PR workflows and unlock additional features, please contact LinearB. |
apirotta92
approved these changes
May 28, 2026
stephenriolo
approved these changes
May 28, 2026
Tazer
approved these changes
May 28, 2026
A reusable workflow's github context (workflow, ref, run_id, job) is identical for every caller-job invocation, so the only thing that distinguishes "build" from "build-mysql8" when both call golang-ci.yml is the inputs they pass. Without this, two such caller jobs would share a concurrency slot and either cancel each other on PRs or serialize on push to main. Enumerate every input in the group key so distinct input combinations get distinct slots, while identical-input duplicate calls correctly share one (since they're doing the same work). Same shape as before — just a richer key. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds workflow-level
concurrency:to all 12 reusable workflows so that rapid PR pushes cancel in-progress runs of the same workflow on the same PR. Pushes tomain/master/release branches and tags are never cancelled (cancel-in-progressis gated ongithub.event_name == 'pull_request'), so tag-and-publish flows likebump-versionanddocker-service-publishkeep their serialization guarantees.Group key strategy:
${{ github.workflow }}-${{ github.ref }}for single-call workflows (bump-version,golang-ci,golang-security)inputs.image→docker-api-service,docker-service,docker-service-build,docker-service-publishinputs.dashboard-path→grafana-dashboard-publish,grafana-dashboard-validateinputs.paths→terraform-v0-ci,terraform-v1-ciinputs.docker-project-name→docker-load-testInside a reusable workflow,
github.workflowandgithub.refresolve to the caller's values, so each consuming repo gets its own per-PR concurrency slot automatically — no changes needed in service repos.Test plan
cancelledand the second runs to completion.mainbranch back-to-back in a consuming repo, confirm both runs complete (second queues behind first, neither is cancelled).docker-service.ymlwith multipleimagevalues runs all matrix variants in parallel (no concurrency collisions).🤖 Generated with Claude Code