Repository navigation
Conversation
GHPullRequest overrides getApiRoute() to /pulls/{n}, so lock() and
unlock() hit /pulls/{n}/lock, which GitHub doesn't serve. Use
getIssuesApiRoute() like the other issue-only endpoints.
Fixes hub4j#2341
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2342 +/- ##
=========================================
Coverage 85.41% 85.41%
Complexity 2568 2568
=========================================
Files 242 242
Lines 7577 7577
Branches 399 399
=========================================
Hits 6472 6472
Misses 869 869
Partials 236 236 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bitwiseman
reviewed
Oct 26, 2026
bitwiseman
requested changes
Oct 26, 2026
Re-fetch the pull request after lock() and unlock() and assert isLocked(). Add the Javadoc the site build's doclint requires.
This branch has not been deployed
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.
Description
GHIssue.lock()andunlock()built their URL fromgetApiRoute(), whichGHPullRequestoverrides to/repos/{owner}/{repo}/pulls/{number}. On a pull request they sentPUT/DELETE .../pulls/{number}/lock, which GitHub doesn't serve, so both failed with a 404. The lock endpoints exist only under/issues/{issue_number}/lockand cover pull requests too ("Users with push access can lock an issue or pull request's conversation."). Both methods now usegetIssuesApiRoute(), like the other issue-only endpoints inGHIssue(comments, labels, assignees, reactions).Fixes #2341
Verification
GHPullRequestTest#lockAndUnlockfails without the fix with the 404 fromGHIssue.lock()/unlock()404 on aGHPullRequest: built on the/pulls/{n}route, GitHub only serves/issues/{n}/lock#2341 (.../pulls/487/lock) and passes with it.PUTandDELETE /repos/{owner}/{repo}/issues/{number}/lockon a real pull request both succeed with an empty response body.Test data
The WireMock data for
lockAndUnlockis synthetic, not atakeSnapshotrecording. The org, repo and pull request responses are reused from themarkReadyForReviewNonDraftrecording (with the title changed). The two lock stubs were written by hand and match real traffic captured against a pull request in another repository: same methods, same/issues/{number}/lockpath, empty response bodies. The twoGET .../pulls/487stubs reuse the same pull request body withlockedset totrue, thenfalse;active_lock_reasonstaysnull, as in the realAppTest#testCreateIssuerecording. Happy to swap in a proper recording if preferred.Prepared with LLM assistance; verified as described above.
Before submitting a PR:
@linkJavaDoc entries to the relevant documentation on https://docs.github.com/en/rest . (n/a: no fetch methods changed)mvn -D enable-ci clean install site "-Dsurefire.argLine=--add-opens java.base/java.net=ALL-UNNAMED"locally. If this command doesn't succeed, your change will not pass CI.main. You will create your PR from that branch.When creating a PR: