Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/main/java/org/kohsuke/github/GHPullRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,30 @@ public PagedIterable<GHPullRequestReview> listReviews() {
.toIterable(GHPullRequestReview[].class, item -> item.wrapUp(this));
}

/**
* Converts a draft pull request to ready for review.
*
* @throws IOException
* the io exception
* @throws IllegalStateException
* if the pull request is not a draft
*/
public void markReadyForReview() throws IOException {
if (!draft) {
throw new IllegalStateException("Pull request is not a draft");
}

StringBuilder inputBuilder = new StringBuilder();
addParameter(inputBuilder, "pullRequestId", this.getNodeId());

String graphqlBody = "mutation MarkReadyForReview { markPullRequestReadyForReview(input: {" + inputBuilder
+ "}) { pullRequest { id } } }";

root().createGraphQLRequest(graphqlBody).sendGraphQL();

refresh();
}

/**
* Merge this pull request.
*
Expand Down
42 changes: 42 additions & 0 deletions src/test/java/org/kohsuke/github/GHPullRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,48 @@ public void getUserTest() throws IOException {
}
}

/**
* Test marking a draft pull request as ready for review.
*
* @throws Exception
* the exception
*/
@Test
public void markReadyForReview() throws Exception {
// Create a draft PR first
GHPullRequest p = getRepository()
.createPullRequest("markReadyForReview", "test/stable", "main", "## test", false, true);
assertThat(p.isDraft(), is(true));

// Mark it ready for review
p.markReadyForReview();

// Verify it's no longer a draft
assertThat(p.isDraft(), is(false));
}

/**
* Marking a non-draft pull request as ready for review throws an exception.
*
* @throws Exception
* the exception
*/
@Test
public void markReadyForReviewNonDraft() throws Exception {
// Create a non-draft PR
GHPullRequest p = getRepository()
.createPullRequest("markReadyForReviewNonDraft", "test/stable", "main", "## test");
assertThat(p.isDraft(), is(false));

// Attempting to mark a non-draft PR as ready should throw
try {
p.markReadyForReview();
fail("Expected IllegalStateException");
} catch (IllegalStateException e) {
assertThat(e.getMessage(), equalTo("Pull request is not a draft"));
}
}

/**
* Merge commit SHA.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"login": "Anonycoders",
"id": 40047636,
"node_id": "MDQ6VXNlcjQwMDQ3NjM2",
"avatar_url": "https://avatars.githubusercontent.com/u/40047636?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/Anonycoders",
"html_url": "https://github.com/Anonycoders",
"followers_url": "https://api.github.com/users/Anonycoders/followers",
"following_url": "https://api.github.com/users/Anonycoders/following{/other_user}",
"gists_url": "https://api.github.com/users/Anonycoders/gists{/gist_id}",
"starred_url": "https://api.github.com/users/Anonycoders/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/Anonycoders/subscriptions",
"organizations_url": "https://api.github.com/users/Anonycoders/orgs",
"repos_url": "https://api.github.com/users/Anonycoders/repos",
"events_url": "https://api.github.com/users/Anonycoders/events{/privacy}",
"received_events_url": "https://api.github.com/users/Anonycoders/received_events",
"type": "User",
"user_view_type": "public",
"site_admin": false,
"name": "Sorena Sarabadani",
"company": "@Adevinta",
"blog": "",
"location": "Berlin, Germany",
"email": "sorena.sarabadani@gmail.com",
"hireable": null,
"bio": "Ex-Shopifyer - Adevinta/Kleinanzeigen",
"twitter_username": "sorena_s",
"notification_email": "sorena.sarabadani@gmail.com",
"public_repos": 12,
"public_gists": 0,
"followers": 38,
"following": 4,
"created_at": "2018-06-08T02:07:15Z",
"updated_at": "2026-01-24T22:07:12Z"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
{
"login": "hub4j-test-org",
"id": 7544739,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
"url": "https://api.github.com/orgs/hub4j-test-org",
"repos_url": "https://api.github.com/orgs/hub4j-test-org/repos",
"events_url": "https://api.github.com/orgs/hub4j-test-org/events",
"hooks_url": "https://api.github.com/orgs/hub4j-test-org/hooks",
"issues_url": "https://api.github.com/orgs/hub4j-test-org/issues",
"members_url": "https://api.github.com/orgs/hub4j-test-org/members{/member}",
"public_members_url": "https://api.github.com/orgs/hub4j-test-org/public_members{/member}",
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
"description": "Hub4j Test Org Description (this could be null or blank too)",
"name": "Hub4j Test Org Name (this could be null or blank too)",
"company": null,
"blog": "https://hub4j.url.io/could/be/null",
"location": "Hub4j Test Org Location (this could be null or blank too)",
"email": "hub4jtestorgemail@could.be.null.com",
"twitter_username": null,
"is_verified": false,
"has_organization_projects": true,
"has_repository_projects": true,
"public_repos": 27,
"public_gists": 0,
"followers": 2,
"following": 0,
"html_url": "https://github.com/hub4j-test-org",
"created_at": "2014-05-10T19:39:11Z",
"updated_at": "2025-08-05T00:53:03Z",
"archived_at": null,
"type": "Organization",
"total_private_repos": 8,
"owned_private_repos": 8,
"private_gists": 0,
"disk_usage": 12076,
"collaborators": 1,
"billing_email": "kk@kohsuke.org",
"default_repository_permission": "none",
"members_can_create_repositories": false,
"two_factor_requirement_enabled": false,
"members_allowed_repository_creation_type": "none",
"members_can_create_public_repositories": false,
"members_can_create_private_repositories": false,
"members_can_create_internal_repositories": false,
"members_can_create_pages": true,
"members_can_fork_private_repositories": false,
"web_commit_signoff_required": false,
"deploy_keys_enabled_for_repositories": false,
"members_can_delete_repositories": true,
"members_can_change_repo_visibility": true,
"members_can_invite_outside_collaborators": true,
"members_can_delete_issues": false,
"display_commenter_full_name_setting_enabled": false,
"readers_can_create_discussions": true,
"members_can_create_teams": true,
"members_can_view_dependency_insights": true,
"default_repository_branch": "main",
"members_can_create_public_pages": true,
"members_can_create_private_pages": true,
"plan": {
"name": "free",
"space": 976562499,
"private_repos": 10000,
"filled_seats": 53,
"seats": 3
},
"advanced_security_enabled_for_new_repositories": false,
"dependabot_alerts_enabled_for_new_repositories": false,
"dependabot_security_updates_enabled_for_new_repositories": false,
"dependency_graph_enabled_for_new_repositories": false,
"secret_scanning_enabled_for_new_repositories": false,
"secret_scanning_push_protection_enabled_for_new_repositories": false,
"secret_scanning_push_protection_custom_link_enabled": false,
"secret_scanning_push_protection_custom_link": null,
"secret_scanning_validity_checks_enabled": false
}
Loading
Loading