Skip to content

[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
backport-4fae29c-v3-2-test
Open

[v3-2-test] CI: Notify open PRs that conflict on uv.lock after main merges (#65765)#65851
github-actions[bot] wants to merge 1 commit intov3-2-testfrom
backport-4fae29c-v3-2-test

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

  • 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

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant