diff --git a/pom.xml b/pom.xml index 4866efb287..2ce3d0fc35 100644 --- a/pom.xml +++ b/pom.xml @@ -281,6 +281,10 @@ maven-surefire-plugin 2.22.2 + + + false + org.codehaus.mojo diff --git a/src/main/java/org/kohsuke/github/GHCheckRun.java b/src/main/java/org/kohsuke/github/GHCheckRun.java index e32ff2e8fb..401f2f8286 100644 --- a/src/main/java/org/kohsuke/github/GHCheckRun.java +++ b/src/main/java/org/kohsuke/github/GHCheckRun.java @@ -51,24 +51,33 @@ GHPullRequest[] wrap() { } /** - * Gets status of the check run. It can be one of "queue", "in_progress", or "completed" + * Gets status of the check run. * * @return Status of the check run + * @see Status */ public String getStatus() { return status; } + public static enum Status { + QUEUED, IN_PROGRESS, COMPLETED + } + /** - * Gets conclusion of a completed check run. It can be one of "success", "failure", "neutral", "cancelled", - * "time_out", or "action_required". + * Gets conclusion of a completed check run. * * @return Status of the check run + * @see Conclusion */ public String getConclusion() { return conclusion; } + public static enum Conclusion { + SUCCESS, FAILURE, NEUTRAL, CANCELLED, TIMED_OUT, ACTION_REQUIRED + } + /** * Gets the custom name of this check run. * @@ -243,4 +252,8 @@ public URL getAnnotationsUrl() { } } + public static enum AnnotationLevel { + NOTICE, WARNING, FAILURE + } + } diff --git a/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java b/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java new file mode 100644 index 0000000000..289bc49898 --- /dev/null +++ b/src/main/java/org/kohsuke/github/GHCheckRunBuilder.java @@ -0,0 +1,291 @@ +/* + * The MIT License + * + * Copyright 2020 CloudBees, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.kohsuke.github; + +import com.fasterxml.jackson.annotation.JsonInclude; +import edu.umd.cs.findbugs.annotations.CheckForNull; +import edu.umd.cs.findbugs.annotations.NonNull; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; + +import java.io.IOException; +import java.util.Collections; +import java.util.Date; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; + +/** + * Drafts a check run. + * + * @see GHCheckRun + * @see GHRepository#createCheckRun + * @see documentation + */ +@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Jackson serializes these even without a getter") +@Preview +@Deprecated +public final class GHCheckRunBuilder { + + private final GHRepository repo; + private final Requester requester; + private Output output; + private List actions; + + GHCheckRunBuilder(GHRepository repo, String name, String headSHA) { + this.repo = repo; + requester = repo.root.createRequest() + .withPreview(Previews.ANTIOPE) + .method("POST") + .with("name", name) + .with("head_sha", headSHA) + .withUrlPath(repo.getApiTailUrl("check-runs")); + } + + public @NonNull GHCheckRunBuilder withDetailsURL(@CheckForNull String detailsURL) { + requester.with("details_url", detailsURL); + return this; + } + + public @NonNull GHCheckRunBuilder withExternalID(@CheckForNull String externalID) { + requester.with("external_id", externalID); + return this; + } + + public @NonNull GHCheckRunBuilder withStatus(@CheckForNull GHCheckRun.Status status) { + if (status != null) { + // Do *not* use the overload taking Enum, as that s/_/-/g which would be wrong here. + requester.with("status", status.toString().toLowerCase(Locale.ROOT)); + } + return this; + } + + public @NonNull GHCheckRunBuilder withConclusion(@CheckForNull GHCheckRun.Conclusion conclusion) { + if (conclusion != null) { + requester.with("conclusion", conclusion.toString().toLowerCase(Locale.ROOT)); + } + return this; + } + + public @NonNull GHCheckRunBuilder withStartedAt(@CheckForNull Date startedAt) { + if (startedAt != null) { + requester.with("started_at", GitHubClient.printDate(startedAt)); + } + return this; + } + + public @NonNull GHCheckRunBuilder withCompletedAt(@CheckForNull Date completedAt) { + if (completedAt != null) { + requester.with("completed_at", GitHubClient.printDate(completedAt)); + } + return this; + } + + public @NonNull GHCheckRunBuilder add(@NonNull Output output) { + if (this.output != null) { + throw new IllegalStateException("cannot add Output twice"); + } + this.output = output; + return this; + } + + public @NonNull GHCheckRunBuilder add(@NonNull Action action) { + if (actions == null) { + actions = new LinkedList<>(); + } + actions.add(action); + return this; + } + + private static final int MAX_ANNOTATIONS = 50; + /** + * Actually creates the check run. (If more than fifty annotations were requested, this is done in batches.) + * + * @return the resulting run + * @throws IOException + * for the usual reasons + */ + public @NonNull GHCheckRun create() throws IOException { + List extraAnnotations; + if (output != null && output.annotations != null && output.annotations.size() > MAX_ANNOTATIONS) { + extraAnnotations = output.annotations.subList(MAX_ANNOTATIONS, output.annotations.size()); + output.annotations = output.annotations.subList(0, MAX_ANNOTATIONS); + } else { + extraAnnotations = Collections.emptyList(); + } + GHCheckRun run = requester.with("output", output).with("actions", actions).fetch(GHCheckRun.class).wrap(repo); + while (!extraAnnotations.isEmpty()) { + Output output2 = new Output(output.title, output.summary); + int i = Math.min(extraAnnotations.size(), MAX_ANNOTATIONS); + output2.annotations = extraAnnotations.subList(0, i); + extraAnnotations = extraAnnotations.subList(i, extraAnnotations.size()); + run = repo.root.createRequest() + .withPreview(Previews.ANTIOPE) + .method("PATCH") + .with("output", output2) + .withUrlPath(repo.getApiTailUrl("check-runs/" + run.id)) + .fetch(GHCheckRun.class) + .wrap(repo); + } + return run; + } + + /** + * @see documentation + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + public static final class Output { + + private final String title; + private final String summary; + private String text; + private List annotations; + private List images; + + public Output(@NonNull String title, @NonNull String summary) { + this.title = title; + this.summary = summary; + } + + public @NonNull Output withText(@CheckForNull String text) { + this.text = text; + return this; + } + + public @NonNull Output add(@NonNull Annotation annotation) { + if (annotations == null) { + annotations = new LinkedList<>(); + } + annotations.add(annotation); + return this; + } + + public @NonNull Output add(@NonNull Image image) { + if (images == null) { + images = new LinkedList<>(); + } + images.add(image); + return this; + } + + } + + /** + * @see documentation + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + public static final class Annotation { + + private final String path; + private final int start_line; + private final int end_line; + private final String annotation_level; + private final String message; + private Integer start_column; + private Integer end_column; + private String title; + private String raw_details; + + public Annotation(@NonNull String path, + int line, + @NonNull GHCheckRun.AnnotationLevel annotationLevel, + @NonNull String message) { + this(path, line, line, annotationLevel, message); + } + + public Annotation(@NonNull String path, + int startLine, + int endLine, + @NonNull GHCheckRun.AnnotationLevel annotationLevel, + @NonNull String message) { + this.path = path; + start_line = startLine; + end_line = endLine; + annotation_level = annotationLevel.toString().toLowerCase(Locale.ROOT); + this.message = message; + } + + public @NonNull Annotation withStartColumn(@CheckForNull Integer startColumn) { + start_column = startColumn; + return this; + } + + public @NonNull Annotation withEndColumn(@CheckForNull Integer endColumn) { + end_column = endColumn; + return this; + } + + public @NonNull Annotation withTitle(@CheckForNull String title) { + this.title = title; + return this; + } + + public @NonNull Annotation withRawDetails(@CheckForNull String rawDetails) { + raw_details = rawDetails; + return this; + } + + } + + /** + * @see documentation + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + public static final class Image { + + private final String alt; + private final String image_url; + private String caption; + + public Image(@NonNull String alt, @NonNull String imageURL) { + this.alt = alt; + image_url = imageURL; + } + + public @NonNull Image withCaption(@CheckForNull String caption) { + this.caption = caption; + return this; + } + + } + + /** + * @see documentation + */ + @JsonInclude(JsonInclude.Include.NON_NULL) + public static final class Action { + + private final String label; + private final String description; + private final String identifier; + + public Action(@NonNull String label, @NonNull String description, @NonNull String identifier) { + this.label = label; + this.description = description; + this.identifier = identifier; + } + + } + +} diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 5ed437af3a..8bf58893e1 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -1849,6 +1849,21 @@ public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, Strin return createCommitStatus(sha1, state, targetUrl, description, null); } + /** + * Creates a check run for a commit. + * + * @param name + * an identifier for the run + * @param headSHA + * the commit hash + * @return a builder which you should customize, then call {@link GHCheckRunBuilder#create} + */ + @Preview + @Deprecated + public @NonNull GHCheckRunBuilder createCheckRun(@NonNull String name, @NonNull String headSHA) { + return new GHCheckRunBuilder(this, name, headSHA); + } + /** * Lists repository events. * diff --git a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java index 3c462196d4..cb2bc1efd0 100644 --- a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java +++ b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java @@ -134,7 +134,7 @@ protected void requireProxy(String reason) { protected void verifyAuthenticated(GitHub instance) { assertThat( - "GitHub connection believes it is anonymous. Make sure you set GITHUB_OAUTH or both GITHUB_USER and GITHUB_PASSWORD environment variables", + "GitHub connection believes it is anonymous. Make sure you set GITHUB_OAUTH or both GITHUB_LOGIN and GITHUB_PASSWORD environment variables", instance.isAnonymous(), Matchers.is(false)); } diff --git a/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java b/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java new file mode 100644 index 0000000000..d9db278994 --- /dev/null +++ b/src/test/java/org/kohsuke/github/GHCheckRunBuilderTest.java @@ -0,0 +1,117 @@ +/* + * The MIT License + * + * Copyright 2020 CloudBees, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.kohsuke.github; + +import org.junit.Test; + +import java.util.Date; + +import static org.hamcrest.Matchers.containsString; + +@SuppressWarnings("deprecation") // preview +public class GHCheckRunBuilderTest extends AbstractGitHubWireMockTest { + + @Test + public void createCheckRun() throws Exception { + GHCheckRun checkRun = gitHub.getRepository("jglick/github-api-test") + .createCheckRun("foo", "4a929d464a2fae7ee899ce603250f7dab304bc4b") + .withStatus(GHCheckRun.Status.COMPLETED) + .withConclusion(GHCheckRun.Conclusion.SUCCESS) + .withDetailsURL("http://nowhere.net/stuff") + .withExternalID("whatever") + .withStartedAt(new Date(999_999_000)) + .withCompletedAt(new Date(999_999_999)) + .add(new GHCheckRunBuilder.Output("Some Title", "what happened…") + .add(new GHCheckRunBuilder.Annotation("stuff.txt", + 1, + GHCheckRun.AnnotationLevel.NOTICE, + "hello to you too").withTitle("Look here")) + .add(new GHCheckRunBuilder.Image("Unikitty", + "https://i.pinimg.com/474x/9e/65/c0/9e65c0972294f1e10f648c9780a79fab.jpg") + .withCaption("Princess Unikitty"))) + .add(new GHCheckRunBuilder.Action("Help", "what I need help with", "doit")) + .create(); + assertEquals("completed", checkRun.getStatus()); + assertEquals(1, checkRun.getOutput().getAnnotationsCount()); + assertEquals(546384586, checkRun.id); + } + + @Test + public void createCheckRunManyAnnotations() throws Exception { + GHCheckRunBuilder.Output output = new GHCheckRunBuilder.Output("Big Run", "Lots of stuff here »"); + for (int i = 0; i < 101; i++) { + output.add( + new GHCheckRunBuilder.Annotation("stuff.txt", 1, GHCheckRun.AnnotationLevel.NOTICE, "hello #" + i)); + } + GHCheckRun checkRun = gitHub.getRepository("jglick/github-api-test") + .createCheckRun("big", "4a929d464a2fae7ee899ce603250f7dab304bc4b") + .withConclusion(GHCheckRun.Conclusion.SUCCESS) + .add(output) + .create(); + assertEquals("completed", checkRun.getStatus()); + assertEquals("Big Run", checkRun.getOutput().getTitle()); + assertEquals("Lots of stuff here »", checkRun.getOutput().getSummary()); + assertEquals(101, checkRun.getOutput().getAnnotationsCount()); + assertEquals(546384622, checkRun.id); + } + + @Test + public void createCheckRunNoAnnotations() throws Exception { + GHCheckRun checkRun = gitHub.getRepository("jglick/github-api-test") + .createCheckRun("quick", "4a929d464a2fae7ee899ce603250f7dab304bc4b") + .withConclusion(GHCheckRun.Conclusion.NEUTRAL) + .add(new GHCheckRunBuilder.Output("Quick note", "nothing more to see here")) + .create(); + assertEquals("completed", checkRun.getStatus()); + assertEquals(0, checkRun.getOutput().getAnnotationsCount()); + assertEquals(546384705, checkRun.id); + } + + @Test + public void createPendingCheckRun() throws Exception { + GHCheckRun checkRun = gitHub.getRepository("jglick/github-api-test") + .createCheckRun("outstanding", "4a929d464a2fae7ee899ce603250f7dab304bc4b") + .withStatus(GHCheckRun.Status.IN_PROGRESS) + .create(); + assertEquals("in_progress", checkRun.getStatus()); + assertNull(checkRun.getConclusion()); + assertEquals(546469053, checkRun.id); + } + + @Test + public void createCheckRunErrMissingConclusion() throws Exception { + try { + gitHub.getRepository("jglick/github-api-test") + .createCheckRun("outstanding", "4a929d464a2fae7ee899ce603250f7dab304bc4b") + .withStatus(GHCheckRun.Status.COMPLETED) + .create(); + fail("should have been rejected"); + } catch (HttpException x) { + assertEquals(422, x.getResponseCode()); + assertThat(x.getMessage(), containsString("\\\"conclusion\\\" wasn't supplied")); + } + } + +} diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/__files/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/__files/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..79eebcc369 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/__files/repos_jglick_github-api-test-1.json @@ -0,0 +1,102 @@ +{ + "id": 95711947, + "node_id": "MDEwOlJlcG9zaXRvcnk5NTcxMTk0Nw==", + "name": "github-api-test", + "full_name": "jglick/github-api-test", + "private": false, + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/jglick/github-api-test", + "description": "A test repository for testingthe github-api project", + "fork": false, + "url": "https://api.github.com/repos/jglick/github-api-test", + "forks_url": "https://api.github.com/repos/jglick/github-api-test/forks", + "keys_url": "https://api.github.com/repos/jglick/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/jglick/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/jglick/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/jglick/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/jglick/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/jglick/github-api-test/events", + "assignees_url": "https://api.github.com/repos/jglick/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/jglick/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/jglick/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/jglick/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/jglick/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/jglick/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/jglick/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/jglick/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/jglick/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/jglick/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/jglick/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/jglick/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/jglick/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/jglick/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/jglick/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/jglick/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/jglick/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/jglick/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/jglick/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/jglick/github-api-test/merges", + "archive_url": "https://api.github.com/repos/jglick/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/jglick/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/jglick/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/jglick/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/jglick/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/jglick/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/jglick/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/jglick/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/jglick/github-api-test/deployments", + "created_at": "2017-06-28T21:10:35Z", + "updated_at": "2020-03-25T22:26:13Z", + "pushed_at": "2020-03-25T22:26:10Z", + "git_url": "git://github.com/jglick/github-api-test.git", + "ssh_url": "git@github.com:jglick/github-api-test.git", + "clone_url": "https://github.com/jglick/github-api-test.git", + "svn_url": "https://github.com/jglick/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": false, + "push": false, + "pull": false + }, + "temp_clone_token": "", + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/__files/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/__files/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..9b1bec7806 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/__files/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,61 @@ +{ + "id": 546384586, + "node_id": "MDg6Q2hlY2tSdW41NDYzODQ1ODY=", + "head_sha": "4a929d464a2fae7ee899ce603250f7dab304bc4b", + "external_id": "whatever", + "url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384586", + "html_url": "https://github.com/jglick/github-api-test/runs/546384586", + "details_url": "http://nowhere.net/stuff", + "status": "completed", + "conclusion": "success", + "started_at": "1970-01-12T13:46:39Z", + "completed_at": "1970-01-12T13:46:39Z", + "output": { + "title": "Some Title", + "summary": "what happened…", + "text": null, + "annotations_count": 1, + "annotations_url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384586/annotations" + }, + "name": "foo", + "check_suite": { + "id": 547824747 + }, + "app": { + "id": 58691, + "slug": "jglick-app-test", + "node_id": "MDM6QXBwNTg2OTE=", + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "name": "jglick-app-test", + "description": "", + "external_url": "http://nowhere.net/", + "html_url": "https://github.com/apps/jglick-app-test", + "created_at": "2020-03-25T22:13:14Z", + "updated_at": "2020-03-25T22:13:14Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/mappings/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/mappings/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..7b8968f764 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/mappings/repos_jglick_github-api-test-1.json @@ -0,0 +1,44 @@ +{ + "id": "0c39468e-dcdc-4f12-bd52-2cf474eb0761", + "name": "repos_jglick_github-api-test", + "request": { + "url": "/repos/jglick/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:29 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4999", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"c31ebce1d9b6ef50784ae33967251c4f\"", + "Last-Modified": "Wed, 25 Mar 2020 22:26:13 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "8558:2D60:F5B004:2327138:5E823921" + } + }, + "uuid": "0c39468e-dcdc-4f12-bd52-2cf474eb0761", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/mappings/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/mappings/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..4e70ef6131 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRun/mappings/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,51 @@ +{ + "id": "3833d102-56d4-455f-9739-94238ae75575", + "name": "repos_jglick_github-api-test_check-runs", + "request": { + "url": "/repos/jglick/github-api-test/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"conclusion\":\"success\",\"output\":{\"title\":\"Some Title\",\"summary\":\"what happened…\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello to you too\",\"title\":\"Look here\"}],\"images\":[{\"alt\":\"Unikitty\",\"image_url\":\"https://i.pinimg.com/474x/9e/65/c0/9e65c0972294f1e10f648c9780a79fab.jpg\",\"caption\":\"Princess Unikitty\"}]},\"completed_at\":\"1970-01-12T13:46:39Z\",\"name\":\"foo\",\"started_at\":\"1970-01-12T13:46:39Z\",\"external_id\":\"whatever\",\"details_url\":\"http://nowhere.net/stuff\",\"actions\":[{\"label\":\"Help\",\"description\":\"what I need help with\",\"identifier\":\"doit\"}],\"head_sha\":\"4a929d464a2fae7ee899ce603250f7dab304bc4b\",\"status\":\"completed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_jglick_github-api-test_check-runs-2.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:30 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4998", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"9b01fc978a7d5144b29fd153f0ed07e4\"", + "Location": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384586", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "8558:2D60:F5B01C:2327144:5E823921" + } + }, + "uuid": "3833d102-56d4-455f-9739-94238ae75575", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/__files/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/__files/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..79eebcc369 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/__files/repos_jglick_github-api-test-1.json @@ -0,0 +1,102 @@ +{ + "id": 95711947, + "node_id": "MDEwOlJlcG9zaXRvcnk5NTcxMTk0Nw==", + "name": "github-api-test", + "full_name": "jglick/github-api-test", + "private": false, + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/jglick/github-api-test", + "description": "A test repository for testingthe github-api project", + "fork": false, + "url": "https://api.github.com/repos/jglick/github-api-test", + "forks_url": "https://api.github.com/repos/jglick/github-api-test/forks", + "keys_url": "https://api.github.com/repos/jglick/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/jglick/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/jglick/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/jglick/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/jglick/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/jglick/github-api-test/events", + "assignees_url": "https://api.github.com/repos/jglick/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/jglick/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/jglick/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/jglick/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/jglick/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/jglick/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/jglick/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/jglick/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/jglick/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/jglick/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/jglick/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/jglick/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/jglick/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/jglick/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/jglick/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/jglick/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/jglick/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/jglick/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/jglick/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/jglick/github-api-test/merges", + "archive_url": "https://api.github.com/repos/jglick/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/jglick/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/jglick/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/jglick/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/jglick/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/jglick/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/jglick/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/jglick/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/jglick/github-api-test/deployments", + "created_at": "2017-06-28T21:10:35Z", + "updated_at": "2020-03-25T22:26:13Z", + "pushed_at": "2020-03-25T22:26:10Z", + "git_url": "git://github.com/jglick/github-api-test.git", + "ssh_url": "git@github.com:jglick/github-api-test.git", + "clone_url": "https://github.com/jglick/github-api-test.git", + "svn_url": "https://github.com/jglick/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": false, + "push": false, + "pull": false + }, + "temp_clone_token": "", + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/mappings/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/mappings/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..549763b0f7 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/mappings/repos_jglick_github-api-test-1.json @@ -0,0 +1,44 @@ +{ + "id": "e95bdd52-5649-401e-a978-4ca6b8adf191", + "name": "repos_jglick_github-api-test", + "request": { + "url": "/repos/jglick/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 19:00:33 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4989", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"c31ebce1d9b6ef50784ae33967251c4f\"", + "Last-Modified": "Wed, 25 Mar 2020 22:26:13 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "BE04:665C:6EB6E0:11A912E:5E8241D1" + } + }, + "uuid": "e95bdd52-5649-401e-a978-4ca6b8adf191", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/mappings/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/mappings/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..d390a69def --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunErrMissingConclusion/mappings/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,45 @@ +{ + "id": "28f2e856-c999-4429-a7b7-e67d8ec0ea96", + "name": "repos_jglick_github-api-test_check-runs", + "request": { + "url": "/repos/jglick/github-api-test/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"outstanding\",\"head_sha\":\"4a929d464a2fae7ee899ce603250f7dab304bc4b\",\"status\":\"completed\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 422, + "body": "{\"message\":\"Invalid request.\\n\\nNo subschema in \\\"anyOf\\\" matched.\\n\\\"conclusion\\\" wasn't supplied.\\ncompleted is not a member of [\\\"queued\\\", \\\"in_progress\\\"].\",\"documentation_url\":\"https://developer.github.com/v3/checks/runs/#create-a-check-run\"}", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 19:00:33 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "422 Unprocessable Entity", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4988", + "X-RateLimit-Reset": "1585596209", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "Vary": "Accept-Encoding, Accept, X-Requested-With", + "X-GitHub-Request-Id": "BE04:665C:6EB6F3:11A9144:5E8241D1" + } + }, + "uuid": "28f2e856-c999-4429-a7b7-e67d8ec0ea96", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..79eebcc369 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test-1.json @@ -0,0 +1,102 @@ +{ + "id": 95711947, + "node_id": "MDEwOlJlcG9zaXRvcnk5NTcxMTk0Nw==", + "name": "github-api-test", + "full_name": "jglick/github-api-test", + "private": false, + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/jglick/github-api-test", + "description": "A test repository for testingthe github-api project", + "fork": false, + "url": "https://api.github.com/repos/jglick/github-api-test", + "forks_url": "https://api.github.com/repos/jglick/github-api-test/forks", + "keys_url": "https://api.github.com/repos/jglick/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/jglick/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/jglick/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/jglick/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/jglick/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/jglick/github-api-test/events", + "assignees_url": "https://api.github.com/repos/jglick/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/jglick/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/jglick/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/jglick/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/jglick/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/jglick/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/jglick/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/jglick/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/jglick/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/jglick/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/jglick/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/jglick/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/jglick/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/jglick/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/jglick/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/jglick/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/jglick/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/jglick/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/jglick/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/jglick/github-api-test/merges", + "archive_url": "https://api.github.com/repos/jglick/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/jglick/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/jglick/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/jglick/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/jglick/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/jglick/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/jglick/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/jglick/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/jglick/github-api-test/deployments", + "created_at": "2017-06-28T21:10:35Z", + "updated_at": "2020-03-25T22:26:13Z", + "pushed_at": "2020-03-25T22:26:10Z", + "git_url": "git://github.com/jglick/github-api-test.git", + "ssh_url": "git@github.com:jglick/github-api-test.git", + "clone_url": "https://github.com/jglick/github-api-test.git", + "svn_url": "https://github.com/jglick/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": false, + "push": false, + "pull": false + }, + "temp_clone_token": "", + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..301d7def5d --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,61 @@ +{ + "id": 546384622, + "node_id": "MDg6Q2hlY2tSdW41NDYzODQ2MjI=", + "head_sha": "4a929d464a2fae7ee899ce603250f7dab304bc4b", + "external_id": "", + "url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622", + "html_url": "https://github.com/jglick/github-api-test/runs/546384622", + "details_url": "http://nowhere.net/", + "status": "completed", + "conclusion": "success", + "started_at": "2020-03-30T18:23:31Z", + "completed_at": "2020-03-30T18:23:31Z", + "output": { + "title": "Big Run", + "summary": "Lots of stuff here »", + "text": null, + "annotations_count": 50, + "annotations_url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622/annotations" + }, + "name": "big", + "check_suite": { + "id": 547824747 + }, + "app": { + "id": 58691, + "slug": "jglick-app-test", + "node_id": "MDM6QXBwNTg2OTE=", + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "name": "jglick-app-test", + "description": "", + "external_url": "http://nowhere.net/", + "html_url": "https://github.com/apps/jglick-app-test", + "created_at": "2020-03-25T22:13:14Z", + "updated_at": "2020-03-25T22:13:14Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs_546384622-3.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs_546384622-3.json new file mode 100644 index 0000000000..16abb0feef --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs_546384622-3.json @@ -0,0 +1,61 @@ +{ + "id": 546384622, + "node_id": "MDg6Q2hlY2tSdW41NDYzODQ2MjI=", + "head_sha": "4a929d464a2fae7ee899ce603250f7dab304bc4b", + "external_id": "", + "url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622", + "html_url": "https://github.com/jglick/github-api-test/runs/546384622", + "details_url": "http://nowhere.net/", + "status": "completed", + "conclusion": "success", + "started_at": "2020-03-30T18:23:31Z", + "completed_at": "2020-03-30T18:23:31Z", + "output": { + "title": "Big Run", + "summary": "Lots of stuff here »", + "text": null, + "annotations_count": 100, + "annotations_url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622/annotations" + }, + "name": "big", + "check_suite": { + "id": 547824747 + }, + "app": { + "id": 58691, + "slug": "jglick-app-test", + "node_id": "MDM6QXBwNTg2OTE=", + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "name": "jglick-app-test", + "description": "", + "external_url": "http://nowhere.net/", + "html_url": "https://github.com/apps/jglick-app-test", + "created_at": "2020-03-25T22:13:14Z", + "updated_at": "2020-03-25T22:13:14Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs_546384622-4.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs_546384622-4.json new file mode 100644 index 0000000000..f1ef833277 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/__files/repos_jglick_github-api-test_check-runs_546384622-4.json @@ -0,0 +1,61 @@ +{ + "id": 546384622, + "node_id": "MDg6Q2hlY2tSdW41NDYzODQ2MjI=", + "head_sha": "4a929d464a2fae7ee899ce603250f7dab304bc4b", + "external_id": "", + "url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622", + "html_url": "https://github.com/jglick/github-api-test/runs/546384622", + "details_url": "http://nowhere.net/", + "status": "completed", + "conclusion": "success", + "started_at": "2020-03-30T18:23:31Z", + "completed_at": "2020-03-30T18:23:31Z", + "output": { + "title": "Big Run", + "summary": "Lots of stuff here »", + "text": null, + "annotations_count": 101, + "annotations_url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622/annotations" + }, + "name": "big", + "check_suite": { + "id": 547824747 + }, + "app": { + "id": 58691, + "slug": "jglick-app-test", + "node_id": "MDM6QXBwNTg2OTE=", + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "name": "jglick-app-test", + "description": "", + "external_url": "http://nowhere.net/", + "html_url": "https://github.com/apps/jglick-app-test", + "created_at": "2020-03-25T22:13:14Z", + "updated_at": "2020-03-25T22:13:14Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..d704fe1b99 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test-1.json @@ -0,0 +1,44 @@ +{ + "id": "0587e4c1-5f7f-4f23-95d7-a9c92945bd77", + "name": "repos_jglick_github-api-test", + "request": { + "url": "/repos/jglick/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:30 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4997", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"c31ebce1d9b6ef50784ae33967251c4f\"", + "Last-Modified": "Wed, 25 Mar 2020 22:26:13 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "855C:28C5:5D190:14A900:5E823922" + } + }, + "uuid": "0587e4c1-5f7f-4f23-95d7-a9c92945bd77", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..154241099c --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,51 @@ +{ + "id": "3ec06672-3a0b-4989-a005-ebbb01b26953", + "name": "repos_jglick_github-api-test_check-runs", + "request": { + "url": "/repos/jglick/github-api-test/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"conclusion\":\"success\",\"output\":{\"title\":\"Big Run\",\"summary\":\"Lots of stuff here »\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #0\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #1\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #2\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #3\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #4\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #5\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #6\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #7\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #8\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #9\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #10\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #11\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #12\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #13\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #14\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #15\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #16\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #17\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #18\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #19\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #20\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #21\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #22\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #23\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #24\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #25\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #26\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #27\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #28\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #29\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #30\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #31\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #32\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #33\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #34\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #35\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #36\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #37\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #38\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #39\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #40\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #41\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #42\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #43\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #44\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #45\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #46\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #47\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #48\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #49\"}]},\"name\":\"big\",\"head_sha\":\"4a929d464a2fae7ee899ce603250f7dab304bc4b\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_jglick_github-api-test_check-runs-2.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:31 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4996", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"2614d382873a09c5179f5dba4ec6e429\"", + "Location": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384622", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "855C:28C5:5D192:14A905:5E823922" + } + }, + "uuid": "3ec06672-3a0b-4989-a005-ebbb01b26953", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs_546384622-3.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs_546384622-3.json new file mode 100644 index 0000000000..d19c8e71c1 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs_546384622-3.json @@ -0,0 +1,50 @@ +{ + "id": "e471f014-e5f7-44b4-bbf1-60f54c7f169e", + "name": "repos_jglick_github-api-test_check-runs_546384622", + "request": { + "url": "/repos/jglick/github-api-test/check-runs/546384622", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"output\":{\"title\":\"Big Run\",\"summary\":\"Lots of stuff here »\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #50\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #51\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #52\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #53\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #54\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #55\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #56\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #57\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #58\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #59\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #60\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #61\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #62\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #63\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #64\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #65\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #66\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #67\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #68\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #69\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #70\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #71\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #72\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #73\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #74\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #75\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #76\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #77\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #78\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #79\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #80\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #81\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #82\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #83\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #84\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #85\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #86\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #87\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #88\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #89\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #90\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #91\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #92\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #93\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #94\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #95\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #96\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #97\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #98\"},{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #99\"}]}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test_check-runs_546384622-3.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:32 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4995", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"4ce23800e47917dad6db9d84f93d5159\"", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "855C:28C5:5D195:14A909:5E823923" + } + }, + "uuid": "e471f014-e5f7-44b4-bbf1-60f54c7f169e", + "persistent": true, + "insertionIndex": 3 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs_546384622-4.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs_546384622-4.json new file mode 100644 index 0000000000..897777b721 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunManyAnnotations/mappings/repos_jglick_github-api-test_check-runs_546384622-4.json @@ -0,0 +1,50 @@ +{ + "id": "64466539-6442-4de8-b824-fba68b6dfb48", + "name": "repos_jglick_github-api-test_check-runs_546384622", + "request": { + "url": "/repos/jglick/github-api-test/check-runs/546384622", + "method": "PATCH", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"output\":{\"title\":\"Big Run\",\"summary\":\"Lots of stuff here »\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #100\"}]}}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test_check-runs_546384622-4.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:32 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4994", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"7691a39148d96449f684f28b159f6dee\"", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "855C:28C5:5D196:14A90B:5E823924" + } + }, + "uuid": "64466539-6442-4de8-b824-fba68b6dfb48", + "persistent": true, + "insertionIndex": 4 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/__files/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/__files/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..79eebcc369 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/__files/repos_jglick_github-api-test-1.json @@ -0,0 +1,102 @@ +{ + "id": 95711947, + "node_id": "MDEwOlJlcG9zaXRvcnk5NTcxMTk0Nw==", + "name": "github-api-test", + "full_name": "jglick/github-api-test", + "private": false, + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/jglick/github-api-test", + "description": "A test repository for testingthe github-api project", + "fork": false, + "url": "https://api.github.com/repos/jglick/github-api-test", + "forks_url": "https://api.github.com/repos/jglick/github-api-test/forks", + "keys_url": "https://api.github.com/repos/jglick/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/jglick/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/jglick/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/jglick/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/jglick/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/jglick/github-api-test/events", + "assignees_url": "https://api.github.com/repos/jglick/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/jglick/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/jglick/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/jglick/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/jglick/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/jglick/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/jglick/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/jglick/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/jglick/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/jglick/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/jglick/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/jglick/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/jglick/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/jglick/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/jglick/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/jglick/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/jglick/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/jglick/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/jglick/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/jglick/github-api-test/merges", + "archive_url": "https://api.github.com/repos/jglick/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/jglick/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/jglick/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/jglick/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/jglick/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/jglick/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/jglick/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/jglick/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/jglick/github-api-test/deployments", + "created_at": "2017-06-28T21:10:35Z", + "updated_at": "2020-03-25T22:26:13Z", + "pushed_at": "2020-03-25T22:26:10Z", + "git_url": "git://github.com/jglick/github-api-test.git", + "ssh_url": "git@github.com:jglick/github-api-test.git", + "clone_url": "https://github.com/jglick/github-api-test.git", + "svn_url": "https://github.com/jglick/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": false, + "push": false, + "pull": false + }, + "temp_clone_token": "", + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/__files/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/__files/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..cfc72da75b --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/__files/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,61 @@ +{ + "id": 546384705, + "node_id": "MDg6Q2hlY2tSdW41NDYzODQ3MDU=", + "head_sha": "4a929d464a2fae7ee899ce603250f7dab304bc4b", + "external_id": "", + "url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384705", + "html_url": "https://github.com/jglick/github-api-test/runs/546384705", + "details_url": "http://nowhere.net/", + "status": "completed", + "conclusion": "neutral", + "started_at": "2020-03-30T18:23:33Z", + "completed_at": "2020-03-30T18:23:33Z", + "output": { + "title": "Quick note", + "summary": "nothing more to see here", + "text": null, + "annotations_count": 0, + "annotations_url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384705/annotations" + }, + "name": "quick", + "check_suite": { + "id": 547824747 + }, + "app": { + "id": 58691, + "slug": "jglick-app-test", + "node_id": "MDM6QXBwNTg2OTE=", + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "name": "jglick-app-test", + "description": "", + "external_url": "http://nowhere.net/", + "html_url": "https://github.com/apps/jglick-app-test", + "created_at": "2020-03-25T22:13:14Z", + "updated_at": "2020-03-25T22:13:14Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/mappings/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/mappings/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..e38e05dcbe --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/mappings/repos_jglick_github-api-test-1.json @@ -0,0 +1,44 @@ +{ + "id": "4f3b8406-df35-48d3-b1aa-e07863c9f6d5", + "name": "repos_jglick_github-api-test", + "request": { + "url": "/repos/jglick/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test-1.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:33 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4993", + "X-RateLimit-Reset": "1585596210", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"c31ebce1d9b6ef50784ae33967251c4f\"", + "Last-Modified": "Wed, 25 Mar 2020 22:26:13 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "8560:6DDE:1F4FD3:627151:5E823924" + } + }, + "uuid": "4f3b8406-df35-48d3-b1aa-e07863c9f6d5", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/mappings/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/mappings/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..0ad6b732f2 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createCheckRunNoAnnotations/mappings/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,51 @@ +{ + "id": "ff9758ac-2cb8-4b47-b26e-9a4b10b43ac0", + "name": "repos_jglick_github-api-test_check-runs", + "request": { + "url": "/repos/jglick/github-api-test/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"conclusion\":\"neutral\",\"output\":{\"title\":\"Quick note\",\"summary\":\"nothing more to see here\"},\"name\":\"quick\",\"head_sha\":\"4a929d464a2fae7ee899ce603250f7dab304bc4b\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_jglick_github-api-test_check-runs-2.json", + "headers": { + "Server": "GitHub.com", + "Date": "Mon, 30 Mar 2020 18:23:33 GMT", + "Content-Type": "application/json; charset=utf-8", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4992", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"e58101b25797856c6f7949ffde281a2c\"", + "Location": "https://api.github.com/repos/jglick/github-api-test/check-runs/546384705", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "8560:6DDE:1F4FD5:627154:5E823925" + } + }, + "uuid": "ff9758ac-2cb8-4b47-b26e-9a4b10b43ac0", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/__files/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/__files/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..79eebcc369 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/__files/repos_jglick_github-api-test-1.json @@ -0,0 +1,102 @@ +{ + "id": 95711947, + "node_id": "MDEwOlJlcG9zaXRvcnk5NTcxMTk0Nw==", + "name": "github-api-test", + "full_name": "jglick/github-api-test", + "private": false, + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "html_url": "https://github.com/jglick/github-api-test", + "description": "A test repository for testingthe github-api project", + "fork": false, + "url": "https://api.github.com/repos/jglick/github-api-test", + "forks_url": "https://api.github.com/repos/jglick/github-api-test/forks", + "keys_url": "https://api.github.com/repos/jglick/github-api-test/keys{/key_id}", + "collaborators_url": "https://api.github.com/repos/jglick/github-api-test/collaborators{/collaborator}", + "teams_url": "https://api.github.com/repos/jglick/github-api-test/teams", + "hooks_url": "https://api.github.com/repos/jglick/github-api-test/hooks", + "issue_events_url": "https://api.github.com/repos/jglick/github-api-test/issues/events{/number}", + "events_url": "https://api.github.com/repos/jglick/github-api-test/events", + "assignees_url": "https://api.github.com/repos/jglick/github-api-test/assignees{/user}", + "branches_url": "https://api.github.com/repos/jglick/github-api-test/branches{/branch}", + "tags_url": "https://api.github.com/repos/jglick/github-api-test/tags", + "blobs_url": "https://api.github.com/repos/jglick/github-api-test/git/blobs{/sha}", + "git_tags_url": "https://api.github.com/repos/jglick/github-api-test/git/tags{/sha}", + "git_refs_url": "https://api.github.com/repos/jglick/github-api-test/git/refs{/sha}", + "trees_url": "https://api.github.com/repos/jglick/github-api-test/git/trees{/sha}", + "statuses_url": "https://api.github.com/repos/jglick/github-api-test/statuses/{sha}", + "languages_url": "https://api.github.com/repos/jglick/github-api-test/languages", + "stargazers_url": "https://api.github.com/repos/jglick/github-api-test/stargazers", + "contributors_url": "https://api.github.com/repos/jglick/github-api-test/contributors", + "subscribers_url": "https://api.github.com/repos/jglick/github-api-test/subscribers", + "subscription_url": "https://api.github.com/repos/jglick/github-api-test/subscription", + "commits_url": "https://api.github.com/repos/jglick/github-api-test/commits{/sha}", + "git_commits_url": "https://api.github.com/repos/jglick/github-api-test/git/commits{/sha}", + "comments_url": "https://api.github.com/repos/jglick/github-api-test/comments{/number}", + "issue_comment_url": "https://api.github.com/repos/jglick/github-api-test/issues/comments{/number}", + "contents_url": "https://api.github.com/repos/jglick/github-api-test/contents/{+path}", + "compare_url": "https://api.github.com/repos/jglick/github-api-test/compare/{base}...{head}", + "merges_url": "https://api.github.com/repos/jglick/github-api-test/merges", + "archive_url": "https://api.github.com/repos/jglick/github-api-test/{archive_format}{/ref}", + "downloads_url": "https://api.github.com/repos/jglick/github-api-test/downloads", + "issues_url": "https://api.github.com/repos/jglick/github-api-test/issues{/number}", + "pulls_url": "https://api.github.com/repos/jglick/github-api-test/pulls{/number}", + "milestones_url": "https://api.github.com/repos/jglick/github-api-test/milestones{/number}", + "notifications_url": "https://api.github.com/repos/jglick/github-api-test/notifications{?since,all,participating}", + "labels_url": "https://api.github.com/repos/jglick/github-api-test/labels{/name}", + "releases_url": "https://api.github.com/repos/jglick/github-api-test/releases{/id}", + "deployments_url": "https://api.github.com/repos/jglick/github-api-test/deployments", + "created_at": "2017-06-28T21:10:35Z", + "updated_at": "2020-03-25T22:26:13Z", + "pushed_at": "2020-03-25T22:26:10Z", + "git_url": "git://github.com/jglick/github-api-test.git", + "ssh_url": "git@github.com:jglick/github-api-test.git", + "clone_url": "https://github.com/jglick/github-api-test.git", + "svn_url": "https://github.com/jglick/github-api-test", + "homepage": "http://github-api.kohsuke.org/", + "size": 0, + "stargazers_count": 0, + "watchers_count": 0, + "language": null, + "has_issues": true, + "has_projects": true, + "has_downloads": true, + "has_wiki": true, + "has_pages": false, + "forks_count": 0, + "mirror_url": null, + "archived": false, + "disabled": false, + "open_issues_count": 0, + "license": null, + "forks": 0, + "open_issues": 0, + "watchers": 0, + "default_branch": "master", + "permissions": { + "admin": false, + "push": false, + "pull": false + }, + "temp_clone_token": "", + "network_count": 0, + "subscribers_count": 0 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/__files/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/__files/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..e6eddb59fd --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/__files/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,61 @@ +{ + "id": 546469053, + "node_id": "MDg6Q2hlY2tSdW41NDY0NjkwNTM=", + "head_sha": "4a929d464a2fae7ee899ce603250f7dab304bc4b", + "external_id": "", + "url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546469053", + "html_url": "https://github.com/jglick/github-api-test/runs/546469053", + "details_url": "http://nowhere.net/", + "status": "in_progress", + "conclusion": null, + "started_at": "2020-03-30T18:57:52Z", + "completed_at": null, + "output": { + "title": null, + "summary": null, + "text": null, + "annotations_count": 0, + "annotations_url": "https://api.github.com/repos/jglick/github-api-test/check-runs/546469053/annotations" + }, + "name": "outstanding", + "check_suite": { + "id": 547824747 + }, + "app": { + "id": 58691, + "slug": "jglick-app-test", + "node_id": "MDM6QXBwNTg2OTE=", + "owner": { + "login": "jglick", + "id": 154109, + "node_id": "MDQ6VXNlcjE1NDEwOQ==", + "avatar_url": "https://avatars1.githubusercontent.com/u/154109?v=4", + "gravatar_id": "", + "url": "https://api.github.com/users/jglick", + "html_url": "https://github.com/jglick", + "followers_url": "https://api.github.com/users/jglick/followers", + "following_url": "https://api.github.com/users/jglick/following{/other_user}", + "gists_url": "https://api.github.com/users/jglick/gists{/gist_id}", + "starred_url": "https://api.github.com/users/jglick/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jglick/subscriptions", + "organizations_url": "https://api.github.com/users/jglick/orgs", + "repos_url": "https://api.github.com/users/jglick/repos", + "events_url": "https://api.github.com/users/jglick/events{/privacy}", + "received_events_url": "https://api.github.com/users/jglick/received_events", + "type": "User", + "site_admin": false + }, + "name": "jglick-app-test", + "description": "", + "external_url": "http://nowhere.net/", + "html_url": "https://github.com/apps/jglick-app-test", + "created_at": "2020-03-25T22:13:14Z", + "updated_at": "2020-03-25T22:13:14Z", + "permissions": { + "checks": "write", + "metadata": "read" + }, + "events": [] + }, + "pull_requests": [] +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/mappings/repos_jglick_github-api-test-1.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/mappings/repos_jglick_github-api-test-1.json new file mode 100644 index 0000000000..e776146ba9 --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/mappings/repos_jglick_github-api-test-1.json @@ -0,0 +1,44 @@ +{ + "id": "c68b6110-412c-483e-84ae-5fbd9a942b3e", + "name": "repos_jglick_github-api-test", + "request": { + "url": "/repos/jglick/github-api-test", + "method": "GET", + "headers": { + "Accept": { + "equalTo": "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2" + } + } + }, + "response": { + "status": 200, + "bodyFileName": "repos_jglick_github-api-test-1.json", + "headers": { + "Date": "Mon, 30 Mar 2020 18:57:51 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "200 OK", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4991", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "W/\"c31ebce1d9b6ef50784ae33967251c4f\"", + "Last-Modified": "Wed, 25 Mar 2020 22:26:13 GMT", + "X-GitHub-Media-Type": "unknown, github.v3", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "864E:3230:CC4EEF:1125A9E:5E82412F" + } + }, + "uuid": "c68b6110-412c-483e-84ae-5fbd9a942b3e", + "persistent": true, + "insertionIndex": 1 +} \ No newline at end of file diff --git a/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/mappings/repos_jglick_github-api-test_check-runs-2.json b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/mappings/repos_jglick_github-api-test_check-runs-2.json new file mode 100644 index 0000000000..3e1900ca0e --- /dev/null +++ b/src/test/resources/org/kohsuke/github/GHCheckRunBuilderTest/wiremock/createPendingCheckRun/mappings/repos_jglick_github-api-test_check-runs-2.json @@ -0,0 +1,51 @@ +{ + "id": "58201935-1587-4494-94ba-7273c91590eb", + "name": "repos_jglick_github-api-test_check-runs", + "request": { + "url": "/repos/jglick/github-api-test/check-runs", + "method": "POST", + "headers": { + "Accept": { + "equalTo": "application/vnd.github.antiope-preview+json" + } + }, + "bodyPatterns": [ + { + "equalToJson": "{\"name\":\"outstanding\",\"head_sha\":\"4a929d464a2fae7ee899ce603250f7dab304bc4b\",\"status\":\"in_progress\"}", + "ignoreArrayOrder": true, + "ignoreExtraElements": true + } + ] + }, + "response": { + "status": 201, + "bodyFileName": "repos_jglick_github-api-test_check-runs-2.json", + "headers": { + "Date": "Mon, 30 Mar 2020 18:57:52 GMT", + "Content-Type": "application/json; charset=utf-8", + "Server": "GitHub.com", + "Status": "201 Created", + "X-RateLimit-Limit": "5000", + "X-RateLimit-Remaining": "4990", + "X-RateLimit-Reset": "1585596209", + "Cache-Control": "private, max-age=60, s-maxage=60", + "Vary": [ + "Accept, Authorization, Cookie, X-GitHub-OTP", + "Accept-Encoding, Accept, X-Requested-With" + ], + "ETag": "\"894104cfc37d9a9efa97ca3ae6ab07f8\"", + "Location": "https://api.github.com/repos/jglick/github-api-test/check-runs/546469053", + "X-GitHub-Media-Type": "github.antiope-preview; format=json", + "Strict-Transport-Security": "max-age=31536000; includeSubdomains; preload", + "X-Frame-Options": "deny", + "X-Content-Type-Options": "nosniff", + "X-XSS-Protection": "1; mode=block", + "Referrer-Policy": "origin-when-cross-origin, strict-origin-when-cross-origin", + "Content-Security-Policy": "default-src 'none'", + "X-GitHub-Request-Id": "864E:3230:CC4EF8:1125AA3:5E82412F" + } + }, + "uuid": "58201935-1587-4494-94ba-7273c91590eb", + "persistent": true, + "insertionIndex": 2 +} \ No newline at end of file