Skip to content

ci: comment on pull requests that overlap other open pull requests - #149

Merged
boykopovar merged 1 commit into
boykopovar:mainfrom
adriadam10:ci/pr-overlap
Sep 30, 2026
Merged

boykopovar merged 1 commit into
boykopovar:mainfrom
adriadam10:ci/pr-overlap

Conversation

@adriadam10

Copy link
Copy Markdown
Collaborator

What

Git only reports a conflict after the first PR is merged, and by then the other author has done the work twice. Adds tools/pr_overlap.py and a workflow that comments on every open PR that overlaps another one:

  • Conflicting files: each PR is merged onto current main, then pairs are merged with each other (git merge-tree, nothing is pushed), so only "merge one, break the other" shows, with the clashing lines on main linked. PRs that already conflict with main are left to the needs rebase label. Touching the same file in different places is not reported.
  • Same exports: both add or change the same APS5_VABI function.
  • Same new files: both add the same path.

Pairs listed in Depends on are skipped, in either direction. PRs by the same author only get the "same new files" check. The comment is edited in place and deleted when the overlap goes away. It runs hourly and on push to main, like the labels, with no pull_request_target.

Locally, before opening a PR: python3 tools/pr_overlap.py --branch HEAD.

On today's main (2021fa6) it would comment on 13 of the 44 open PRs. Some examples:

Preview of the comment those PRs would get, rendered on my fork with the links pointed back here: #147, #68, #130.

Tested

  • Ran it locally against the 44 open PRs (about 3 s, 5.5 MB fetched from a fresh clone). 83 pairs share at least one file; 64 of them merge cleanly and are not reported.
  • Checked on a 300-line .md that it follows git's own rules: lines 10 and 250 merge cleanly, while 10 and 11, or the same line, conflict.
  • On my fork, with test PRs that add the same file:

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw; silent stubs are listed in TechnicalDebt n/a
  • No notes, investigation .md files or images added to the repository
  • New third-party code is a submodule built from source n/a
  • Generic behaviour, not specific to one title n/a
  • Depends on: none
  • AI-assisted: yes

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the ci .github label Sep 29, 2026
@boykopovar

Copy link
Copy Markdown
Owner

It would also be useful if your CI, which delivers labels, made the "need rebase" label red (in a separate PR). Does GitHub allow this?

@adriadam10 adriadam10 mentioned this pull request Sep 30, 2026
9 tasks done
@adriadam10

Copy link
Copy Markdown
Collaborator Author

Yes — labels created by actions default to grey, but their color can be set through the API. Opened #189: a small workflow that sets color and description for needs rebase (red) and the area labels, on push to main or manually. It only updates those labels and leaves the rest untouched.

@boykopovar
boykopovar merged commit 1dfdd70 into boykopovar:main Sep 30, 2026
3 checks passed
@adriadam10
adriadam10 deleted the ci/pr-overlap branch October 3, 2026 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci .github

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants