ci: auto-close superseded sync PRs after a sync merges - #121
Merged
Conversation
auto-merge-sync merges a passing sync PR but never closed the older sync PRs it superseded. A sync PR that fails CI is never merged by this job, so once a newer sync overtakes it, it lingers as an orphan (this is what left #109/#113/#114 open and failing until they were closed by hand). After the merge, check out the public intelligence-flow repo for history and close every open sync/intelligence-flow-* PR whose source commit is an ancestor of the just-merged source (already included), skipping the merged branch itself and leaving newer, not-yet-merged syncs untouched. Reuses the primitives already in the pipeline: gh pr list --json, git merge-base --is-ancestor, the sync branch prefix, and UPSTREAM.json's source.commit.
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.
Why
auto-merge-syncmerges a passing sync PR but never closes the older sync PRs it supersedes. A sync PR that fails CI is never merged by this job, so once a newer sync overtakes it, it lingers as an orphan. That's exactly what left #109/#113/#114 open and failing (they predated the #198 hydration fix) until they were closed by hand.What
After the merge step,
auto-merge-syncnow:operatorstack/intelligence-flow(fetch-depth: 0) for history — default token, no scope change;UPSTREAM.json, and for every opensync/intelligence-flow-*PR closes the ones whose source commit is an ancestor of the merged source (already included), skipping the merged branch itself and leaving newer, not-yet-merged syncs untouched.Reuses primitives already in the pipeline:
gh pr list --json,git merge-base --is-ancestor(as insync-upstream.yml), thesync/intelligence-flow-branch prefix, andUPSTREAM.json'ssource.commit. Closing uses the existing app token (pull-requests: write).Scope:
.github/workflows/ci.ymlonly — boatstack-owned control plane, not projected from intelligence-flow, so it survives every sync.Verification
ci.ymlparses as valid YAML.merged = 70614614(current main), the three orphans that were closed by hand (d4c1a8ecc53f,68bcc5284017,16019bc487af) are all selected for close; the merged sync (70614614df37) is skipped; an unknown SHA is kept.