Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4953f45

Browse filesBrowse files
committed
Create check run updater
1 parent 78f533b commit 4953f45
Copy full SHA for 4953f45

File tree

Expand file treeCollapse file tree

2 files changed

+37
-10
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+37
-10
lines changed

‎src/main/java/org/kohsuke/github/GHCheckRun.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCheckRun.java
+12Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.kohsuke.github;
22

33
import com.fasterxml.jackson.annotation.JsonProperty;
4+
import edu.umd.cs.findbugs.annotations.NonNull;
45
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
56

67
import java.io.IOException;
@@ -292,4 +293,15 @@ public static enum AnnotationLevel {
292293
NOTICE, WARNING, FAILURE
293294
}
294295

296+
/**
297+
* Updates this check run.
298+
*
299+
* @return a builder which you should customize, then call {@link GHCheckRunBuilder#create}
300+
*/
301+
@Preview
302+
@Deprecated
303+
public @NonNull GHCheckRunBuilder update() {
304+
return new GHCheckRunBuilder(owner, getId());
305+
}
306+
295307
}

‎src/main/java/org/kohsuke/github/GHCheckRunBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHCheckRunBuilder.java
+25-10Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,30 +37,45 @@
3737
import java.util.Locale;
3838

3939
/**
40-
* Drafts a check run.
40+
* Drafts or updates a check run.
4141
*
4242
* @see GHCheckRun
4343
* @see GHRepository#createCheckRun
4444
* @see <a href="https://developer.github.com/v3/checks/runs/#create-a-check-run">documentation</a>
45+
* @see GHCheckRun#update()
46+
* @see <a href="https://developer.github.com/v3/checks/runs/#update-a-check-run">documentation</a>
4547
*/
4648
@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Jackson serializes these even without a getter")
4749
@Preview
4850
@Deprecated
4951
public final class GHCheckRunBuilder {
5052

51-
private final GHRepository repo;
52-
private final Requester requester;
53+
protected final GHRepository repo;
54+
protected final Requester requester;
5355
private Output output;
5456
private List<Action> actions;
5557

56-
GHCheckRunBuilder(GHRepository repo, String name, String headSHA) {
58+
private GHCheckRunBuilder(GHRepository repo, Requester requester) {
5759
this.repo = repo;
58-
requester = repo.root.createRequest()
59-
.withPreview(Previews.ANTIOPE)
60-
.method("POST")
61-
.with("name", name)
62-
.with("head_sha", headSHA)
63-
.withUrlPath(repo.getApiTailUrl("check-runs"));
60+
this.requester = requester;
61+
}
62+
63+
GHCheckRunBuilder(GHRepository repo, String name, String headSHA) {
64+
this(repo,
65+
repo.root.createRequest()
66+
.withPreview(Previews.ANTIOPE)
67+
.method("POST")
68+
.with("name", name)
69+
.with("head_sha", headSHA)
70+
.withUrlPath(repo.getApiTailUrl("check-runs")));
71+
}
72+
73+
GHCheckRunBuilder(GHRepository repo, long checkId) {
74+
this(repo,
75+
repo.root.createRequest()
76+
.withPreview(Previews.ANTIOPE)
77+
.method("PATCH")
78+
.withUrlPath(repo.getApiTailUrl("check-runs/" + checkId)));
6479
}
6580

6681
public @NonNull GHCheckRunBuilder withDetailsURL(@CheckForNull String detailsURL) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.