Skip to content

ci: auto-close superseded sync PRs after a sync merges - #121

Merged
bigboateng merged 1 commit into
mainfrom
chore/auto-close-superseded-sync-prs
Jul 26, 2026
Merged

ci: auto-close superseded sync PRs after a sync merges#121
bigboateng merged 1 commit into
mainfrom
chore/auto-close-superseded-sync-prs

Conversation

@bigboateng

Copy link
Copy Markdown
Contributor

Why

auto-merge-sync merges 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-sync now:

  1. checks out the public operatorstack/intelligence-flow (fetch-depth: 0) for history — default token, no scope change;
  2. reads the just-merged source commit from UPSTREAM.json, and for every open sync/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 in sync-upstream.yml), the sync/intelligence-flow- branch prefix, and UPSTREAM.json's source.commit. Closing uses the existing app token (pull-requests: write).

Scope: .github/workflows/ci.yml only — boatstack-owned control plane, not projected from intelligence-flow, so it survives every sync.

Verification

  • ci.yml parses as valid YAML.
  • Dry-ran the ancestry loop against real history: with 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.
  • No behavior change to the merge path itself; the backlog is already clear, so the step is a no-op until a future orphan appears (the intended steady state).

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.
@bigboateng
bigboateng merged commit 0fd3e89 into main Jul 26, 2026
9 checks passed
@bigboateng
bigboateng deleted the chore/auto-close-superseded-sync-prs branch July 26, 2026 15:52
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