[v3-2-test] CI: Notify open PRs that conflict on uv.lock after main merges (#65765)#65851
Open
github-actions[bot] wants to merge 1 commit intov3-2-testfrom
Open
[v3-2-test] CI: Notify open PRs that conflict on uv.lock after main merges (#65765)#65851github-actions[bot] wants to merge 1 commit intov3-2-testfrom
github-actions[bot] wants to merge 1 commit intov3-2-testfrom
Conversation
…erges (#65765) * CI: Notify open PRs that conflict on uv.lock after main merges When `uv.lock` changes on `main`, open PRs that touch `uv.lock` frequently end up with rebase conflicts. This adds a workflow that, on each push to `main` that modifies `uv.lock`, scans open non-draft PRs (updated in the last 14 days), identifies those currently reporting conflicts, and posts (or updates, deduped via an HTML-comment marker) a single comment with rebase-and-`uv lock` instructions. The source PR that caused the change is resolved from the squash-merge commit headline's trailing `(#NNN)` and linked in the notice. Implemented as a standalone PEP 723 Python script (`httpx` + GitHub's GraphQL API) so logic stays testable; workflow YAML is a thin driver that installs `uv` from `uv.lock` and runs the script. Unit tests cover the regex, classifier, pagination/early-exit, UNKNOWN-mergeable retry loop, and notice posting. * Fix scripts-tests by stubbing httpx in unit-test module The scripts-project CI venv doesn't have httpx installed, so importing ``notify_uv_lock_conflicts`` fails with ``ModuleNotFoundError: No module named 'httpx'`` before any test runs. httpx is a PEP 723 runtime dep of the script; the tests mock the client and never need the real library. Stub ``httpx`` in ``sys.modules`` with ``setdefault`` before loading the module under test: keeps the scripts distribution's declared deps unchanged, and leaves real ``httpx`` alone when present (e.g. in the workspace-wide dev environment). (cherry picked from commit 4fae29c) Co-authored-by: Jarek Potiuk <jarek@potiuk.com>
5 tasks
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.
When
uv.lockchanges onmain, open PRs that touchuv.lockfrequentlyend up with rebase conflicts. This adds a workflow that, on each push to
mainthat modifiesuv.lock, scans open non-draft PRs (updated in thelast 14 days), identifies those currently reporting conflicts, and posts
(or updates, deduped via an HTML-comment marker) a single comment with
rebase-and-
uv lockinstructions.The source PR that caused the change is resolved from the squash-merge
commit headline's trailing
(#NNN)and linked in the notice.Implemented as a standalone PEP 723 Python script (
httpx+ GitHub'sGraphQL API) so logic stays testable; workflow YAML is a thin driver that
installs
uvfromuv.lockand runs the script. Unit tests cover theregex, classifier, pagination/early-exit, UNKNOWN-mergeable retry loop,
and notice posting.
The scripts-project CI venv doesn't have httpx installed, so importing
notify_uv_lock_conflictsfails withModuleNotFoundError: No module named 'httpx'before any test runs. httpx is a PEP 723 runtime dep ofthe script; the tests mock the client and never need the real library.
Stub
httpxinsys.moduleswithsetdefaultbefore loading themodule under test: keeps the scripts distribution's declared deps
unchanged, and leaves real
httpxalone when present (e.g. in theworkspace-wide dev environment).
(cherry picked from commit 4fae29c)
Co-authored-by: Jarek Potiuk jarek@potiuk.com