diff --git a/src/main/java/org/kohsuke/github/GHPullRequest.java b/src/main/java/org/kohsuke/github/GHPullRequest.java index 128f819d5b..ac91ad8c3b 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequest.java +++ b/src/main/java/org/kohsuke/github/GHPullRequest.java @@ -629,6 +629,66 @@ public enum MergeMethod { REBASE } + /** + * Request to enable auto merge for a pull request. + * + * @param authorEmail + * The email address to associate with this merge. + * @param clientMutationId + * A unique identifier for the client performing the mutation. + * @param commitBody + * Commit body to use for the commit when the PR is mergable; if omitted, a default message will be used. + * NOTE: when merging with a merge queue any input value for commit message is ignored. + * @param commitHeadline + * Commit headline to use for the commit when the PR is mergable; if omitted, a default message will be + * used. NOTE: when merging with a merge queue any input value for commit headline is ignored. + * @param expectedHeadOid + * The expected head OID of the pull request. + * @param mergeMethod + * The merge method to use. If omitted, defaults to `MERGE`. NOTE: when merging with a merge queue any + * input value for merge method is ignored. + * @throws IOException + * the io exception + */ + public void enablePullRequestAutoMerge(String authorEmail, + String clientMutationId, + String commitBody, + String commitHeadline, + String expectedHeadOid, + MergeMethod mergeMethod) throws IOException { + + StringBuilder inputBuilder = new StringBuilder(); + addParameter(inputBuilder, "pullRequestId", this.getNodeId()); + addOptionalParameter(inputBuilder, "authorEmail", authorEmail); + addOptionalParameter(inputBuilder, "clientMutationId", clientMutationId); + addOptionalParameter(inputBuilder, "commitBody", commitBody); + addOptionalParameter(inputBuilder, "commitHeadline", commitHeadline); + addOptionalParameter(inputBuilder, "expectedHeadOid", expectedHeadOid); + addOptionalParameter(inputBuilder, "mergeMethod", mergeMethod); + + String graphqlBody = "mutation EnableAutoMerge { enablePullRequestAutoMerge(input: {" + inputBuilder + "}) { " + + "pullRequest { id } } }"; + + root().createGraphQLRequest(graphqlBody).sendGraphQL(); + + refresh(); + } + + private void addOptionalParameter(StringBuilder inputBuilder, String name, Object value) { + if (value != null) { + addParameter(inputBuilder, name, value); + } + } + + private void addParameter(StringBuilder inputBuilder, String name, Object value) { + Objects.requireNonNull(value); + String formatString = " %s: \"%s\""; + if (value instanceof Enum) { + formatString = " %s: %s"; + } + + inputBuilder.append(String.format(formatString, name, value)); + } /** * The status of auto merging a {@linkplain GHPullRequest}. * diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index 8ef21e2cd0..33cc329be1 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -1299,6 +1299,21 @@ Requester createRequest() { return requester; } + /** + * Creates a request to GitHub GraphQL API. + * + * @param query + * the query for the GraphQL + * @return the requester + */ + @Nonnull + Requester createGraphQLRequest(String query) { + return createRequest().method("POST") + .rateLimit(RateLimitTarget.GRAPHQL) + .with("query", query) + .withUrlPath("/graphql"); + } + /** * Intern. * diff --git a/src/main/java/org/kohsuke/github/Requester.java b/src/main/java/org/kohsuke/github/Requester.java index ad65f1a2d1..8a012ef0e2 100644 --- a/src/main/java/org/kohsuke/github/Requester.java +++ b/src/main/java/org/kohsuke/github/Requester.java @@ -27,6 +27,7 @@ import org.apache.commons.io.IOUtils; import org.kohsuke.github.connector.GitHubConnectorResponse; import org.kohsuke.github.function.InputStreamFunction; +import org.kohsuke.github.internal.graphql.response.GHGraphQLResponse; import java.io.ByteArrayInputStream; import java.io.IOException; @@ -103,6 +104,37 @@ public T fetchInto(@Nonnull T existingInstance) throws IOException { .body(); } + /** + * Sends a GraphQL request with no response + * + * @throws IOException + * the io exception + */ + public void sendGraphQL() throws IOException { + fetchGraphQL(GHGraphQLResponse.ObjectResponse.class); + } + + /** + * Sends a request and parses the response into the given type via databinding in GraphQL response. + * + * @param + * the type parameter + * @param type + * the type + * @return an instance of {@code GHGraphQLResponse} + * @throws IOException + * if the server returns 4xx/5xx responses. + */ + public , S> S fetchGraphQL(@Nonnull Class type) throws IOException { + T response = fetch(type); + + if (!response.isSuccessful()) { + throw new IOException("GraphQL request failed by:" + response.getErrorMessages()); + } + + return response.getData(); + } + /** * Makes a request and just obtains the HTTP status code. Method does not throw exceptions for many status codes * that would otherwise throw. diff --git a/src/main/java/org/kohsuke/github/internal/graphql/response/GHGraphQLResponse.java b/src/main/java/org/kohsuke/github/internal/graphql/response/GHGraphQLResponse.java new file mode 100644 index 0000000000..54960aa556 --- /dev/null +++ b/src/main/java/org/kohsuke/github/internal/graphql/response/GHGraphQLResponse.java @@ -0,0 +1,93 @@ +package org.kohsuke.github.internal.graphql.response; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +/** + * A response of GraphQL. + *

+ * This class is used to parse the response of GraphQL. + *

+ * + * @param + * the type of data + */ +public class GHGraphQLResponse { + + private final T data; + + private final List errors; + + /** + * @param data + * GraphQL success response + * @param errors + * GraphQL failure response, This will be empty if not fail + */ + @JsonCreator + @SuppressFBWarnings(value = { "EI_EXPOSE_REP2" }, justification = "Spotbugs also doesn't like this") + public GHGraphQLResponse(@JsonProperty("data") T data, @JsonProperty("errors") List errors) { + if (errors == null) { + errors = Collections.emptyList(); + } + this.data = data; + this.errors = Collections.unmodifiableList(errors); + } + + /** + * @return request is succeeded. True when error list is empty. + */ + public boolean isSuccessful() { + return errors.isEmpty(); + } + + /** + * @return GraphQL success response + */ + public T getData() { + if (!isSuccessful()) { + throw new RuntimeException("Response not successful, data invalid"); + } + + return data; + } + + /** + * @return GraphQL error messages from Github Response. Empty list when no errors occurred. + */ + public List getErrorMessages() { + return errors.stream().map(GraphQLError::getMessage).collect(Collectors.toList()); + } + + /** + * A error of GraphQL response. Minimum implementation for GraphQL error. + */ + @SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, + justification = "JSON API") + private static class GraphQLError { + private String message; + + public String getMessage() { + return message; + } + } + + /** + * A GraphQL response with basic Object data type. + */ + public static class ObjectResponse extends GHGraphQLResponse { + /** + * {@inheritDoc} + */ + @JsonCreator + @SuppressFBWarnings(value = { "EI_EXPOSE_REP2" }, justification = "Spotbugs also doesn't like this") + public ObjectResponse(@JsonProperty("data") Object data, @JsonProperty("errors") List errors) { + super(data, errors); + } + } +} diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json index 4d691214ec..24935c34be 100644 --- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json +++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/reflect-config.json @@ -6703,5 +6703,95 @@ "allDeclaredMethods": true, "allPublicClasses": true, "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.GHPullRequest$EnablePullRequestAutoMergeResponse", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.GHPullRequest$EnablePullRequestAutoMergeResponse$EnablePullRequestAutoMerge", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.GHPullRequest$EnablePullRequestAutoMergeResponse$EnablePullRequestAutoMerge$EnablePullRequestAutoMergePullRequest", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.internal.graphql.response.GHGraphQLResponse", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.internal.graphql.response.GHGraphQLResponse$GraphQLError", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true + }, + { + "name": "org.kohsuke.github.internal.graphql.response.GHGraphQLResponse$ObjectResponse", + "allPublicFields": true, + "allDeclaredFields": true, + "queryAllPublicConstructors": true, + "queryAllDeclaredConstructors": true, + "allPublicConstructors": true, + "allDeclaredConstructors": true, + "queryAllPublicMethods": true, + "queryAllDeclaredMethods": true, + "allPublicMethods": true, + "allDeclaredMethods": true, + "allPublicClasses": true, + "allDeclaredClasses": true } ] diff --git a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json index 3e80bb939b..0bb21a1624 100644 --- a/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json +++ b/src/main/resources/META-INF/native-image/org.kohsuke/github-api/serialization-config.json @@ -1342,5 +1342,23 @@ }, { "name": "org.kohsuke.github.SkipFromToString" + }, + { + "name": "org.kohsuke.github.GHPullRequest$EnablePullRequestAutoMergeResponse" + }, + { + "name": "org.kohsuke.github.GHPullRequest$EnablePullRequestAutoMergeResponse$EnablePullRequestAutoMerge" + }, + { + "name": "org.kohsuke.github.GHPullRequest$EnablePullRequestAutoMergeResponse$EnablePullRequestAutoMerge$EnablePullRequestAutoMergePullRequest" + }, + { + "name": "org.kohsuke.github.internal.graphql.response.GHGraphQLResponse" + }, + { + "name": "org.kohsuke.github.internal.graphql.response.GHGraphQLResponse$GraphQLError" + }, + { + "name": "org.kohsuke.github.internal.graphql.response.GHGraphQLResponse$ObjectResponse" } ] diff --git a/src/test/java/org/kohsuke/github/GHPullRequestMockTest.java b/src/test/java/org/kohsuke/github/GHPullRequestMockTest.java index 45dd9af9f5..b84c905546 100644 --- a/src/test/java/org/kohsuke/github/GHPullRequestMockTest.java +++ b/src/test/java/org/kohsuke/github/GHPullRequestMockTest.java @@ -33,5 +33,4 @@ public void shouldMockGHPullRequest() throws IOException { assertThat("Mock should return true", pullRequest.isDraft()); } - } diff --git a/src/test/java/org/kohsuke/github/GHPullRequestTest.java b/src/test/java/org/kohsuke/github/GHPullRequestTest.java index 0a2e4a2712..6cccefe51e 100644 --- a/src/test/java/org/kohsuke/github/GHPullRequestTest.java +++ b/src/test/java/org/kohsuke/github/GHPullRequestTest.java @@ -1036,6 +1036,65 @@ public void refreshFromSearchResults() throws Exception { pullRequestFromSearchResults.close(); } + /** + * + * Test enabling auto merge for pull request + * + * @throws IOException + * the Exception + */ + @Test + public void enablePullRequestAutoMerge() throws IOException { + String authorEmail = "sa20207@naver.com"; + String clientMutationId = "github-api"; + String commitBody = "This is commit body."; + String commitTitle = "This is commit title."; + String expectedCommitHeadOid = "4888b44d7204dd05680e90159af839c8b1194b6d"; + + GHPullRequest pullRequest = gitHub.getRepository("seate/for-test").getPullRequest(9); + + pullRequest.enablePullRequestAutoMerge(authorEmail, + clientMutationId, + commitBody, + commitTitle, + expectedCommitHeadOid, + GHPullRequest.MergeMethod.MERGE); + + AutoMerge autoMerge = pullRequest.getAutoMerge(); + assertThat(autoMerge.getEnabledBy().getEmail(), is(authorEmail)); + assertThat(autoMerge.getCommitMessage(), is(commitBody)); + assertThat(autoMerge.getCommitTitle(), is(commitTitle)); + assertThat(autoMerge.getMergeMethod(), is(GHPullRequest.MergeMethod.MERGE)); + } + + /** + * Test enabling auto merge for pull request with no verified email throws GraphQL exception + * + * @throws IOException + * the io exception + */ + @Test + public void enablePullRequestAutoMergeFailure() throws IOException { + String authorEmail = "failureEmail@gmail.com"; + String clientMutationId = "github-api"; + String commitBody = "This is commit body."; + String commitTitle = "This is commit title."; + String expectedCommitHeadOid = "4888b44d7204dd05680e90159af839c8b1194b6d"; + + GHPullRequest pullRequest = gitHub.getRepository("seate/for-test").getPullRequest(9); + + try { + pullRequest.enablePullRequestAutoMerge(authorEmail, + clientMutationId, + commitBody, + commitTitle, + expectedCommitHeadOid, + null); + } catch (IOException e) { + assertThat(e.getMessage(), containsString("does not have a verified email")); + } + } + /** * Gets the repository. * diff --git a/src/test/java/org/kohsuke/github/internal/graphql/response/GHGraphQLResponseMockTest.java b/src/test/java/org/kohsuke/github/internal/graphql/response/GHGraphQLResponseMockTest.java new file mode 100644 index 0000000000..5365c9e69f --- /dev/null +++ b/src/test/java/org/kohsuke/github/internal/graphql/response/GHGraphQLResponseMockTest.java @@ -0,0 +1,74 @@ +package org.kohsuke.github.internal.graphql.response; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.ObjectReader; +import org.junit.jupiter.api.Test; + +import java.util.List; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.is; + +/** + * Test GHGraphQLResponse's methods + */ +class GHGraphQLResponseMockTest { + + /** + * Test get data throws exception when response means error + * + * @throws JsonProcessingException + * Json parse exception + * + */ + @Test + void getDataFailure() throws JsonProcessingException { + String graphQLErrorResponse = "{\"data\": {\"enablePullRequestAutoMerge\": null},\"errors\": [{\"type\": " + + "\"UNPROCESSABLE\",\"path\": [\"enablePullRequestAutoMerge\"],\"locations\": [{\"line\": 2," + + "\"column\": 5}],\"message\": \"hub4j does not have a verified email, which is required to enable " + + "auto-merging.\"}]}"; + + GHGraphQLResponse response = convertJsonToGraphQLResponse(graphQLErrorResponse); + + try { + response.getData(); + } catch (RuntimeException e) { + assertThat(e.getMessage(), containsString("Response not successful, data invalid")); + } + } + + /** + * Test getErrorMessages throws exception when response means not error + * + * @throws JsonProcessingException + * Json parse exception + */ + @Test + void getErrorMessagesFailure() throws JsonProcessingException { + String graphQLSuccessResponse = "{\"data\": {\"repository\": {\"pullRequest\": {\"id\": " + + "\"PR_TEMP_GRAPHQL_ID\"}}}}"; + + GHGraphQLResponse response = convertJsonToGraphQLResponse(graphQLSuccessResponse); + + List errorMessages = response.getErrorMessages(); + + assertThat(errorMessages, is(empty())); + } + + private GHGraphQLResponse convertJsonToGraphQLResponse(String json) throws JsonProcessingException { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + + ObjectReader objectReader = objectMapper.reader(); + JavaType javaType = objectReader.getTypeFactory() + .constructParametricType(GHGraphQLResponse.class, Object.class); + + return objectReader.forType(javaType).readValue(json); + } + +} diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/1-user.json new file mode 100644 index 0000000000..76578d3e42 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/1-user.json @@ -0,0 +1,36 @@ +{ + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false, + "name": "KIMSIWOO", + "company": "Inha university", + "blog": "", + "location": null, + "email": "sa20207@naver.com", + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": "sa20207@naver.com", + "public_repos": 34, + "public_gists": 0, + "followers": 2, + "following": 2, + "created_at": "2021-07-02T07:40:16Z", + "updated_at": "2025-03-03T13:26:53Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/2-r_s_for-test.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/2-r_s_for-test.json new file mode 100644 index 0000000000..c2de0d78c0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/2-r_s_for-test.json @@ -0,0 +1,139 @@ +{ + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": true, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "security_and_analysis": { + "secret_scanning": { + "status": "disabled" + }, + "secret_scanning_push_protection": { + "status": "disabled" + }, + "dependabot_security_updates": { + "status": "disabled" + }, + "secret_scanning_non_provider_patterns": { + "status": "disabled" + }, + "secret_scanning_validity_checks": { + "status": "disabled" + } + }, + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/3-r_s_f_pulls_9.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/3-r_s_f_pulls_9.json new file mode 100644 index 0000000000..11347dec30 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/3-r_s_f_pulls_9.json @@ -0,0 +1,372 @@ +{ + "url": "https://api.github.com/repos/seate/for-test/pulls/9", + "id": 2395455682, + "node_id": "PR_kwDON6BPMc6Ox8DC", + "html_url": "https://github.com/seate/for-test/pull/9", + "diff_url": "https://github.com/seate/for-test/pull/9.diff", + "patch_url": "https://github.com/seate/for-test/pull/9.patch", + "issue_url": "https://api.github.com/repos/seate/for-test/issues/9", + "number": 9, + "state": "open", + "locked": false, + "title": "github-api enable pull request auto merge test", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "body": "github-api enable pull request auto merge test", + "created_at": "2025-03-15T16:07:53Z", + "updated_at": "2025-03-15T16:18:20Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "25a5888073ee3d2a975e012492950dddb8c346dc", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/seate/for-test/pulls/9/commits", + "review_comments_url": "https://api.github.com/repos/seate/for-test/pulls/9/comments", + "review_comment_url": "https://api.github.com/repos/seate/for-test/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/seate/for-test/issues/9/comments", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/4888b44d7204dd05680e90159af839c8b1194b6d", + "head": { + "label": "seate:test1", + "ref": "test1", + "sha": "4888b44d7204dd05680e90159af839c8b1194b6d", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop" + } + }, + "base": { + "label": "seate:develop", + "ref": "develop", + "sha": "2bc9cde73b377e4d0ebda0d19f636644808388f5", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9" + }, + "html": { + "href": "https://github.com/seate/for-test/pull/9" + }, + "issue": { + "href": "https://api.github.com/repos/seate/for-test/issues/9" + }, + "comments": { + "href": "https://api.github.com/repos/seate/for-test/issues/9/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/seate/for-test/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/seate/for-test/statuses/4888b44d7204dd05680e90159af839c8b1194b6d" + } + }, + "author_association": "OWNER", + "auto_merge": { + "enabled_by": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "merge_method": "merge", + "commit_title": "This is commit title.", + "commit_message": "This is commit body." + }, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "blocked", + "merged_by": null, + "comments": 1, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 16, + "additions": 642, + "deletions": 0, + "changed_files": 19 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/6-r_s_f_pulls_9.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/6-r_s_f_pulls_9.json new file mode 100644 index 0000000000..11347dec30 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/6-r_s_f_pulls_9.json @@ -0,0 +1,372 @@ +{ + "url": "https://api.github.com/repos/seate/for-test/pulls/9", + "id": 2395455682, + "node_id": "PR_kwDON6BPMc6Ox8DC", + "html_url": "https://github.com/seate/for-test/pull/9", + "diff_url": "https://github.com/seate/for-test/pull/9.diff", + "patch_url": "https://github.com/seate/for-test/pull/9.patch", + "issue_url": "https://api.github.com/repos/seate/for-test/issues/9", + "number": 9, + "state": "open", + "locked": false, + "title": "github-api enable pull request auto merge test", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "body": "github-api enable pull request auto merge test", + "created_at": "2025-03-15T16:07:53Z", + "updated_at": "2025-03-15T16:18:20Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "25a5888073ee3d2a975e012492950dddb8c346dc", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/seate/for-test/pulls/9/commits", + "review_comments_url": "https://api.github.com/repos/seate/for-test/pulls/9/comments", + "review_comment_url": "https://api.github.com/repos/seate/for-test/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/seate/for-test/issues/9/comments", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/4888b44d7204dd05680e90159af839c8b1194b6d", + "head": { + "label": "seate:test1", + "ref": "test1", + "sha": "4888b44d7204dd05680e90159af839c8b1194b6d", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop" + } + }, + "base": { + "label": "seate:develop", + "ref": "develop", + "sha": "2bc9cde73b377e4d0ebda0d19f636644808388f5", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9" + }, + "html": { + "href": "https://github.com/seate/for-test/pull/9" + }, + "issue": { + "href": "https://api.github.com/repos/seate/for-test/issues/9" + }, + "comments": { + "href": "https://api.github.com/repos/seate/for-test/issues/9/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/seate/for-test/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/seate/for-test/statuses/4888b44d7204dd05680e90159af839c8b1194b6d" + } + }, + "author_association": "OWNER", + "auto_merge": { + "enabled_by": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "merge_method": "merge", + "commit_title": "This is commit title.", + "commit_message": "This is commit body." + }, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "blocked", + "merged_by": null, + "comments": 1, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 16, + "additions": 642, + "deletions": 0, + "changed_files": 19 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/7-users_seate.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/7-users_seate.json new file mode 100644 index 0000000000..ae11f23591 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/__files/7-users_seate.json @@ -0,0 +1,35 @@ +{ + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false, + "name": "KIMSIWOO", + "company": "Inha university", + "blog": "", + "location": null, + "email": "sa20207@naver.com", + "hireable": null, + "bio": null, + "twitter_username": null, + "public_repos": 34, + "public_gists": 0, + "followers": 2, + "following": 2, + "created_at": "2021-07-02T07:40:16Z", + "updated_at": "2025-03-03T13:26:53Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/1-user.json new file mode 100644 index 0000000000..4b252141e4 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/1-user.json @@ -0,0 +1,47 @@ +{ + "id": "08dbdf10-b416-4ff3-b2f8-3985f3f99bb9", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:24 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"91439c9cd22b1066c90ef899df4f995dcda9ed34b86d5e107b7c311aaaff2136\"", + "Last-Modified": "Mon, 03 Mar 2025 13:26:53 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1742065904", + "X-RateLimit-Used": "11", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "F688:2B46D8:3A9875:59C85D:67D5C344" + } + }, + "uuid": "08dbdf10-b416-4ff3-b2f8-3985f3f99bb9", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/2-r_s_for-test.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/2-r_s_for-test.json new file mode 100644 index 0000000000..6fcd708edf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/2-r_s_for-test.json @@ -0,0 +1,47 @@ +{ + "id": "efe9930f-f284-49cb-ac98-1870d22d0454", + "name": "repos_seate_for-test", + "request": { + "url": "/repos/seate/for-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_s_for-test.json", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:27 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"9181d2d37a58759c6739fb93cdf26cbc7b9cc04f34e87456932f65921cb5473d\"", + "Last-Modified": "Sat, 15 Mar 2025 16:06:51 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1742065904", + "X-RateLimit-Used": "16", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "F68A:165A85:3BCFDE:5B22D9:67D5C347" + } + }, + "uuid": "efe9930f-f284-49cb-ac98-1870d22d0454", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/3-r_s_f_pulls_9.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/3-r_s_f_pulls_9.json new file mode 100644 index 0000000000..f3a8eab80c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/3-r_s_f_pulls_9.json @@ -0,0 +1,50 @@ +{ + "id": "4b26d080-5f51-45ea-90b9-dfbe0751cdb5", + "name": "repos_seate_for-test_pulls_9", + "request": { + "url": "/repos/seate/for-test/pulls/9", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_s_f_pulls_9.json", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:27 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"4cb91abd4bd5effc3228763b88c5abec155f063e483efaa6ba284bb351e27687\"", + "Last-Modified": "Sat, 15 Mar 2025 16:18:20 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4983", + "X-RateLimit-Reset": "1742065904", + "X-RateLimit-Used": "17", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "F68B:15724C:3AAF79:5A026E:67D5C347" + } + }, + "uuid": "4b26d080-5f51-45ea-90b9-dfbe0751cdb5", + "persistent": true, + "scenarioName": "scenario-1-repos-seate-for-test-pulls-9", + "requiredScenarioState": "Started", + "newScenarioState": "scenario-1-repos-seate-for-test-pulls-9-2", + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/4-graphql.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/4-graphql.json new file mode 100644 index 0000000000..42db1e78ba --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/4-graphql.json @@ -0,0 +1,50 @@ +{ + "id": "89c6825e-6277-4ad0-a9f0-d0cb70e5a15b", + "name": "graphql", + "request": { + "url": "/graphql", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"query\":\"query GetPullRequestID { repository(name: \\\"for-test\\\", owner: \\\"seate\\\") { pullRequest(number: 9) { id } } }\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "body": "{\"data\":{\"repository\":{\"pullRequest\":{\"id\":\"PR_kwDON6BPMc6Ox8DC\"}}}}", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:28 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "github.v4; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1742063501", + "X-RateLimit-Used": "19", + "X-RateLimit-Resource": "graphql", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "F68C:2403B3:120286:1B2D2F:67D5C348" + } + }, + "uuid": "89c6825e-6277-4ad0-a9f0-d0cb70e5a15b", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/5-graphql.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/5-graphql.json new file mode 100644 index 0000000000..7aff47b1cf --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/5-graphql.json @@ -0,0 +1,50 @@ +{ + "id": "ff9bdb46-fb2a-44c2-a164-9a790e11c26c", + "name": "graphql", + "request": { + "url": "/graphql", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"query\":\"mutation EnableAutoMerge { enablePullRequestAutoMerge(input: { pullRequestId: \\\"PR_kwDON6BPMc6Ox8DC\\\" authorEmail: \\\"sa20207@naver.com\\\" clientMutationId: \\\"github-api\\\" commitBody: \\\"This is commit body.\\\" commitHeadline: \\\"This is commit title.\\\" expectedHeadOid: \\\"4888b44d7204dd05680e90159af839c8b1194b6d\\\" mergeMethod: MERGE}) { pullRequest { id } } }\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "body": "{\"data\":{\"enablePullRequestAutoMerge\":{\"pullRequest\":{\"id\":\"PR_kwDON6BPMc6Ox8DC\"}}}}", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:28 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "github.v4; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4980", + "X-RateLimit-Reset": "1742063501", + "X-RateLimit-Used": "20", + "X-RateLimit-Resource": "graphql", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "F68D:4F3EE:3B15C8:5A6881:67D5C348" + } + }, + "uuid": "ff9bdb46-fb2a-44c2-a164-9a790e11c26c", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/6-r_s_f_pulls_9.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/6-r_s_f_pulls_9.json new file mode 100644 index 0000000000..f25e8a33f0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/6-r_s_f_pulls_9.json @@ -0,0 +1,49 @@ +{ + "id": "0dd48f53-a8fb-4df8-ba9e-946146f68a33", + "name": "repos_seate_for-test_pulls_9", + "request": { + "url": "/repos/seate/for-test/pulls/9", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "6-r_s_f_pulls_9.json", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"4cb91abd4bd5effc3228763b88c5abec155f063e483efaa6ba284bb351e27687\"", + "Last-Modified": "Sat, 15 Mar 2025 16:18:20 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4982", + "X-RateLimit-Reset": "1742065904", + "X-RateLimit-Used": "18", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "F68E:7ED0E:3A2A32:597D10:67D5C348" + } + }, + "uuid": "0dd48f53-a8fb-4df8-ba9e-946146f68a33", + "persistent": true, + "scenarioName": "scenario-1-repos-seate-for-test-pulls-9", + "requiredScenarioState": "scenario-1-repos-seate-for-test-pulls-9-2", + "insertionIndex": 6 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/7-users_seate.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/7-users_seate.json new file mode 100644 index 0000000000..51c6c8da18 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMerge/mappings/7-users_seate.json @@ -0,0 +1,47 @@ +{ + "id": "90286178-d879-4d06-ac33-48c714b16fc2", + "name": "users_seate", + "request": { + "url": "/users/seate", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "7-users_seate.json", + "headers": { + "Date": "Sat, 15 Mar 2025 18:13:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"0e08109bbc9b14a5d7838fffe7e57d5025e9ee8825089eb2c05f3681b890cbf4\"", + "Last-Modified": "Mon, 03 Mar 2025 13:26:53 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4981", + "X-RateLimit-Reset": "1742065904", + "X-RateLimit-Used": "19", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "F68F:124DB4:3CBA1A:5C0D00:67D5C349" + } + }, + "uuid": "90286178-d879-4d06-ac33-48c714b16fc2", + "persistent": true, + "insertionIndex": 7 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/1-user.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/1-user.json new file mode 100644 index 0000000000..76578d3e42 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/1-user.json @@ -0,0 +1,36 @@ +{ + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false, + "name": "KIMSIWOO", + "company": "Inha university", + "blog": "", + "location": null, + "email": "sa20207@naver.com", + "hireable": null, + "bio": null, + "twitter_username": null, + "notification_email": "sa20207@naver.com", + "public_repos": 34, + "public_gists": 0, + "followers": 2, + "following": 2, + "created_at": "2021-07-02T07:40:16Z", + "updated_at": "2025-03-03T13:26:53Z" +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/2-r_s_for-test.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/2-r_s_for-test.json new file mode 100644 index 0000000000..c2de0d78c0 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/2-r_s_for-test.json @@ -0,0 +1,139 @@ +{ + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop", + "permissions": { + "admin": true, + "maintain": true, + "push": true, + "triage": true, + "pull": true + }, + "temp_clone_token": "", + "allow_squash_merge": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_auto_merge": true, + "delete_branch_on_merge": false, + "allow_update_branch": false, + "use_squash_pr_title_as_default": false, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "security_and_analysis": { + "secret_scanning": { + "status": "disabled" + }, + "secret_scanning_push_protection": { + "status": "disabled" + }, + "dependabot_security_updates": { + "status": "disabled" + }, + "secret_scanning_non_provider_patterns": { + "status": "disabled" + }, + "secret_scanning_validity_checks": { + "status": "disabled" + } + }, + "network_count": 0, + "subscribers_count": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/3-r_s_f_pulls_9.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/3-r_s_f_pulls_9.json new file mode 100644 index 0000000000..11347dec30 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/__files/3-r_s_f_pulls_9.json @@ -0,0 +1,372 @@ +{ + "url": "https://api.github.com/repos/seate/for-test/pulls/9", + "id": 2395455682, + "node_id": "PR_kwDON6BPMc6Ox8DC", + "html_url": "https://github.com/seate/for-test/pull/9", + "diff_url": "https://github.com/seate/for-test/pull/9.diff", + "patch_url": "https://github.com/seate/for-test/pull/9.patch", + "issue_url": "https://api.github.com/repos/seate/for-test/issues/9", + "number": 9, + "state": "open", + "locked": false, + "title": "github-api enable pull request auto merge test", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "body": "github-api enable pull request auto merge test", + "created_at": "2025-03-15T16:07:53Z", + "updated_at": "2025-03-15T16:18:20Z", + "closed_at": null, + "merged_at": null, + "merge_commit_sha": "25a5888073ee3d2a975e012492950dddb8c346dc", + "assignee": null, + "assignees": [], + "requested_reviewers": [], + "requested_teams": [], + "labels": [], + "milestone": null, + "draft": false, + "commits_url": "https://api.github.com/repos/seate/for-test/pulls/9/commits", + "review_comments_url": "https://api.github.com/repos/seate/for-test/pulls/9/comments", + "review_comment_url": "https://api.github.com/repos/seate/for-test/pulls/comments{/number}", + "comments_url": "https://api.github.com/repos/seate/for-test/issues/9/comments", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/4888b44d7204dd05680e90159af839c8b1194b6d", + "head": { + "label": "seate:test1", + "ref": "test1", + "sha": "4888b44d7204dd05680e90159af839c8b1194b6d", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop" + } + }, + "base": { + "label": "seate:develop", + "ref": "develop", + "sha": "2bc9cde73b377e4d0ebda0d19f636644808388f5", + "user": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "repo": { + "id": 933252913, + "node_id": "R_kgDON6BPMQ", + "name": "for-test", + "full_name": "seate/for-test", + "private": false, + "owner": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "html_url": "https://github.com/seate/for-test", + "description": "깃허브 테스트용 레포", + "fork": false, + "url": "https://api.github.com/repos/seate/for-test", + "forks_url": "https://api.github.com/repos/seate/for-test/forks", + "keys_url": "https://api.github.com/repos/seate/for-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/seate/for-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/seate/for-test/teams", + "hooks_url": "https://api.github.com/repos/seate/for-test/hooks", + "issue_events_url": "https://api.github.com/repos/seate/for-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/seate/for-test/events", + "assignees_url": "https://api.github.com/repos/seate/for-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/seate/for-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/seate/for-test/tags", + "blobs_url": "https://api.github.com/repos/seate/for-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/seate/for-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/seate/for-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/seate/for-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/seate/for-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/seate/for-test/languages", + "stargazers_url": "https://api.github.com/repos/seate/for-test/stargazers", + "contributors_url": "https://api.github.com/repos/seate/for-test/contributors", + "subscribers_url": "https://api.github.com/repos/seate/for-test/subscribers", + "subscription_url": "https://api.github.com/repos/seate/for-test/subscription", + "commits_url": "https://api.github.com/repos/seate/for-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/seate/for-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/seate/for-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/seate/for-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/seate/for-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/seate/for-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/seate/for-test/merges", + "archive_url": "https://api.github.com/repos/seate/for-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/seate/for-test/downloads", + "issues_url": "https://api.github.com/repos/seate/for-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/seate/for-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/seate/for-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/seate/for-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/seate/for-test/labels{/name}", + "releases_url": "https://api.github.com/repos/seate/for-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/seate/for-test/deployments", + "created_at": "2025-02-15T14:21:31Z", + "updated_at": "2025-03-15T16:06:51Z", + "pushed_at": "2025-03-15T16:17:01Z", + "git_url": "git://github.com/seate/for-test.git", + "ssh_url": "git@github.com:seate/for-test.git", + "clone_url": "https://github.com/seate/for-test.git", + "svn_url": "https://github.com/seate/for-test", + "homepage": null, + "size": 62, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "has_discussions": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 3, + "license": null, + "allow_forking": true, + "is_template": false, + "web_commit_signoff_required": false, + "topics": [], + "visibility": "public", + "forks": 0, + "open_issues": 3, + "watchers": 0, + "default_branch": "develop" + } + }, + "_links": { + "self": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9" + }, + "html": { + "href": "https://github.com/seate/for-test/pull/9" + }, + "issue": { + "href": "https://api.github.com/repos/seate/for-test/issues/9" + }, + "comments": { + "href": "https://api.github.com/repos/seate/for-test/issues/9/comments" + }, + "review_comments": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9/comments" + }, + "review_comment": { + "href": "https://api.github.com/repos/seate/for-test/pulls/comments{/number}" + }, + "commits": { + "href": "https://api.github.com/repos/seate/for-test/pulls/9/commits" + }, + "statuses": { + "href": "https://api.github.com/repos/seate/for-test/statuses/4888b44d7204dd05680e90159af839c8b1194b6d" + } + }, + "author_association": "OWNER", + "auto_merge": { + "enabled_by": { + "login": "seate", + "id": 86824703, + "node_id": "MDQ6VXNlcjg2ODI0NzAz", + "avatar_url": "https://avatars.githubusercontent.com/u/86824703?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/seate", + "html_url": "https://github.com/seate", + "followers_url": "https://api.github.com/users/seate/followers", + "following_url": "https://api.github.com/users/seate/following{/other_user}", + "gists_url": "https://api.github.com/users/seate/gists{/gist_id}", + "starred_url": "https://api.github.com/users/seate/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/seate/subscriptions", + "organizations_url": "https://api.github.com/users/seate/orgs", + "repos_url": "https://api.github.com/users/seate/repos", + "events_url": "https://api.github.com/users/seate/events{/privacy}", + "received_events_url": "https://api.github.com/users/seate/received_events", + "type": "User", + "user_view_type": "public", + "site_admin": false + }, + "merge_method": "merge", + "commit_title": "This is commit title.", + "commit_message": "This is commit body." + }, + "active_lock_reason": null, + "merged": false, + "mergeable": true, + "rebaseable": true, + "mergeable_state": "blocked", + "merged_by": null, + "comments": 1, + "review_comments": 0, + "maintainer_can_modify": false, + "commits": 16, + "additions": 642, + "deletions": 0, + "changed_files": 19 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/1-user.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/1-user.json new file mode 100644 index 0000000000..a6b92d442d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/1-user.json @@ -0,0 +1,47 @@ +{ + "id": "931de630-5c54-4bb3-877f-16430f46887f", + "name": "user", + "request": { + "url": "/user", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "1-user.json", + "headers": { + "Date": "Mon, 17 Mar 2025 07:04:43 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"91439c9cd22b1066c90ef899df4f995dcda9ed34b86d5e107b7c311aaaff2136\"", + "Last-Modified": "Mon, 03 Mar 2025 13:26:53 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1742197445", + "X-RateLimit-Used": "10", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "E025:4F3EE:A59617:F8E5A6:67D7C98B" + } + }, + "uuid": "931de630-5c54-4bb3-877f-16430f46887f", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/2-r_s_for-test.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/2-r_s_for-test.json new file mode 100644 index 0000000000..268fdf44ea --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/2-r_s_for-test.json @@ -0,0 +1,47 @@ +{ + "id": "cea6580e-f17f-43e1-b5c9-e27077b6ff17", + "name": "repos_seate_for-test", + "request": { + "url": "/repos/seate/for-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "2-r_s_for-test.json", + "headers": { + "Date": "Mon, 17 Mar 2025 07:04:45 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"9181d2d37a58759c6739fb93cdf26cbc7b9cc04f34e87456932f65921cb5473d\"", + "Last-Modified": "Sat, 15 Mar 2025 16:06:51 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4985", + "X-RateLimit-Reset": "1742197445", + "X-RateLimit-Used": "15", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "E027:1EF85A:16C064:1D9E9C:67D7C98D" + } + }, + "uuid": "cea6580e-f17f-43e1-b5c9-e27077b6ff17", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/3-r_s_f_pulls_9.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/3-r_s_f_pulls_9.json new file mode 100644 index 0000000000..06d04c10ad --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/3-r_s_f_pulls_9.json @@ -0,0 +1,47 @@ +{ + "id": "88725e34-4c36-4681-bc6a-f82ff05b80ef", + "name": "repos_seate_for-test_pulls_9", + "request": { + "url": "/repos/seate/for-test/pulls/9", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "3-r_s_f_pulls_9.json", + "headers": { + "Date": "Mon, 17 Mar 2025 07:04:46 GMT", + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": "Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With", + "ETag": "W/\"4cb91abd4bd5effc3228763b88c5abec155f063e483efaa6ba284bb351e27687\"", + "Last-Modified": "Sat, 15 Mar 2025 16:18:20 GMT", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "", + "X-GitHub-Media-Type": "github.v3; format=json", + "x-github-api-version-selected": "2022-11-28", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4984", + "X-RateLimit-Reset": "1742197445", + "X-RateLimit-Used": "16", + "X-RateLimit-Resource": "core", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Server": "github.com", + "X-GitHub-Request-Id": "E028:1F17C6:160FCD:1CEEA4:67D7C98D" + } + }, + "uuid": "88725e34-4c36-4681-bc6a-f82ff05b80ef", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/4-graphql.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/4-graphql.json new file mode 100644 index 0000000000..f1e592ffb3 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/4-graphql.json @@ -0,0 +1,50 @@ +{ + "id": "ab9b1fcc-2e83-46f8-82a7-a5a6b19b9958", + "name": "graphql", + "request": { + "url": "/graphql", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"query\":\"query GetPullRequestID { repository(name: \\\"for-test\\\", owner: \\\"seate\\\") { pullRequest(number: 9) { id } } }\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "body": "{\"data\":{\"repository\":{\"pullRequest\":{\"id\":\"PR_kwDON6BPMc6Ox8DC\"}}}}", + "headers": { + "Date": "Mon, 17 Mar 2025 07:04:46 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "github.v4; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4923", + "X-RateLimit-Reset": "1742196376", + "X-RateLimit-Used": "77", + "X-RateLimit-Resource": "graphql", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "E029:3882B9:169857:1D842A:67D7C98E" + } + }, + "uuid": "ab9b1fcc-2e83-46f8-82a7-a5a6b19b9958", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/5-graphql.json b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/5-graphql.json new file mode 100644 index 0000000000..1f2dc6f418 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHPullRequestTest/wiremock/enablePullRequestAutoMergeFailure/mappings/5-graphql.json @@ -0,0 +1,50 @@ +{ + "id": "d219868c-dc53-4642-863d-64a268d3c115", + "name": "graphql", + "request": { + "url": "/graphql", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"query\":\"mutation EnableAutoMerge { enablePullRequestAutoMerge(input: { pullRequestId: \\\"PR_kwDON6BPMc6Ox8DC\\\" authorEmail: \\\"failureEmail@gmail.com\\\" clientMutationId: \\\"github-api\\\" commitBody: \\\"This is commit body.\\\" commitHeadline: \\\"This is commit title.\\\" expectedHeadOid: \\\"4888b44d7204dd05680e90159af839c8b1194b6d\\\"}) { pullRequest { id } } }\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": false + } + ] + }, + "response": { + "status": 200, + "body": "{\"data\":{\"enablePullRequestAutoMerge\":null},\"errors\":[{\"type\":\"UNPROCESSABLE\",\"path\":[\"enablePullRequestAutoMerge\"],\"locations\":[{\"line\":1,\"column\":28}],\"message\":\"seate does not have a verified email, which is required to enable auto-merging.\"}]}", + "headers": { + "Date": "Mon, 17 Mar 2025 07:04:47 GMT", + "Content-Type": "application/json; charset=utf-8", + "X-OAuth-Scopes": "admin:repo_hook, gist, notifications, read:discussion, read:org, read:project, repo, user:email", + "X-Accepted-OAuth-Scopes": "repo", + "X-GitHub-Media-Type": "github.v4; format=json", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4922", + "X-RateLimit-Reset": "1742196376", + "X-RateLimit-Used": "78", + "X-RateLimit-Resource": "graphql", + "Access-Control-Expose-Headers": "ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset", + "Access-Control-Allow-Origin": "*", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "0", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "Server": "github.com", + "X-GitHub-Request-Id": "E02A:FA314:AB056F:FE5536:67D7C98E" + } + }, + "uuid": "d219868c-dc53-4642-863d-64a268d3c115", + "persistent": true, + "insertionIndex": 5 +} \ No newline at end of file