mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Make sure that output.text is set in each checks call.
If a GitHub checks contains more than 50 annotations, then the check is split into several calls. This fix makes sure that all additional calls will not only copy the properties `title` and `summary` but also the previously missing property `text`.
This commit is contained in:
@@ -152,7 +152,7 @@ public final class GHCheckRunBuilder {
|
||||
}
|
||||
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);
|
||||
Output output2 = new Output(output.title, output.summary).withText(output.text);
|
||||
int i = Math.min(extraAnnotations.size(), MAX_ANNOTATIONS);
|
||||
output2.annotations = extraAnnotations.subList(0, i);
|
||||
extraAnnotations = extraAnnotations.subList(i, extraAnnotations.size());
|
||||
|
||||
@@ -49,7 +49,7 @@ public class GHCheckRunBuilderTest extends AbstractGHAppInstallationTest {
|
||||
.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.Output("Some Title", "what happened…").withText("Hello Text!")
|
||||
.add(new GHCheckRunBuilder.Annotation("stuff.txt",
|
||||
1,
|
||||
GHCheckRun.AnnotationLevel.NOTICE,
|
||||
@@ -62,11 +62,14 @@ public class GHCheckRunBuilderTest extends AbstractGHAppInstallationTest {
|
||||
assertEquals("completed", checkRun.getStatus());
|
||||
assertEquals(1, checkRun.getOutput().getAnnotationsCount());
|
||||
assertEquals(1424883286, checkRun.getId());
|
||||
assertEquals("Hello Text!", checkRun.getOutput().getText());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createCheckRunManyAnnotations() throws Exception {
|
||||
GHCheckRunBuilder.Output output = new GHCheckRunBuilder.Output("Big Run", "Lots of stuff here »");
|
||||
GHCheckRunBuilder.Output output = new GHCheckRunBuilder.Output("Big Run", "Lots of stuff here »")
|
||||
.withText("Hello Text!");
|
||||
|
||||
for (int i = 0; i < 101; i++) {
|
||||
output.add(
|
||||
new GHCheckRunBuilder.Annotation("stuff.txt", 1, GHCheckRun.AnnotationLevel.NOTICE, "hello #" + i));
|
||||
@@ -80,6 +83,7 @@ public class GHCheckRunBuilderTest extends AbstractGHAppInstallationTest {
|
||||
assertEquals("Big Run", checkRun.getOutput().getTitle());
|
||||
assertEquals("Lots of stuff here »", checkRun.getOutput().getSummary());
|
||||
assertEquals(101, checkRun.getOutput().getAnnotationsCount());
|
||||
assertEquals("Hello Text!", checkRun.getOutput().getText());
|
||||
assertEquals(1424883599, checkRun.getId());
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"output": {
|
||||
"title": "Some Title",
|
||||
"summary": "what happened…",
|
||||
"text": null,
|
||||
"text": "Hello Text!",
|
||||
"annotations_count": 1,
|
||||
"annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883286/annotations"
|
||||
},
|
||||
@@ -58,4 +58,4 @@
|
||||
"events": []
|
||||
},
|
||||
"pull_requests": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"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\":\"89a9ae301e35e667756034fdc933b1fc94f63fc1\",\"status\":\"completed\"}",
|
||||
"equalToJson": "{\"conclusion\":\"success\",\"output\":{\"title\":\"Some Title\",\"summary\":\"what happened…\",\"text\":\"Hello Text!\",\"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\":\"89a9ae301e35e667756034fdc933b1fc94f63fc1\",\"status\":\"completed\"}",
|
||||
"ignoreArrayOrder": true,
|
||||
"ignoreExtraElements": false
|
||||
}
|
||||
@@ -50,4 +50,4 @@
|
||||
"uuid": "b1eec35d-bc33-49b6-a44b-4dcf13cc0f1b",
|
||||
"persistent": true,
|
||||
"insertionIndex": 5
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"output": {
|
||||
"title": "Big Run",
|
||||
"summary": "Lots of stuff here »",
|
||||
"text": null,
|
||||
"text": "Hello Text!",
|
||||
"annotations_count": 50,
|
||||
"annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883599/annotations"
|
||||
},
|
||||
@@ -58,4 +58,4 @@
|
||||
"events": []
|
||||
},
|
||||
"pull_requests": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"output": {
|
||||
"title": "Big Run",
|
||||
"summary": "Lots of stuff here »",
|
||||
"text": null,
|
||||
"text": "Hello Text!",
|
||||
"annotations_count": 101,
|
||||
"annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883599/annotations"
|
||||
},
|
||||
@@ -58,4 +58,4 @@
|
||||
"events": []
|
||||
},
|
||||
"pull_requests": []
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"output": {
|
||||
"title": "Big Run",
|
||||
"summary": "Lots of stuff here »",
|
||||
"text": null,
|
||||
"text": "Hello Text!",
|
||||
"annotations_count": 100,
|
||||
"annotations_url": "https://api.github.com/repos/hub4j-test-org/test-checks/check-runs/1424883599/annotations"
|
||||
},
|
||||
@@ -58,4 +58,4 @@
|
||||
"events": []
|
||||
},
|
||||
"pull_requests": []
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"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\"}]}}",
|
||||
"equalToJson": "{\"output\":{\"title\":\"Big Run\",\"summary\":\"Lots of stuff here »\",\"text\":\"Hello Text!\",\"annotations\":[{\"path\":\"stuff.txt\",\"start_line\":1,\"end_line\":1,\"annotation_level\":\"notice\",\"message\":\"hello #100\"}]}}",
|
||||
"ignoreArrayOrder": true,
|
||||
"ignoreExtraElements": false
|
||||
}
|
||||
@@ -49,4 +49,4 @@
|
||||
"uuid": "b00d927c-1c6c-4f49-b568-68327ef7d436",
|
||||
"persistent": true,
|
||||
"insertionIndex": 7
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user