|
37 | 37 | import java.util.Locale; |
38 | 38 |
|
39 | 39 | /** |
40 | | - * Drafts a check run. |
| 40 | + * Drafts or updates a check run. |
41 | 41 | * |
42 | 42 | * @see GHCheckRun |
43 | 43 | * @see GHRepository#createCheckRun |
44 | 44 | * @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> |
45 | 47 | */ |
46 | 48 | @SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Jackson serializes these even without a getter") |
47 | 49 | @Preview |
48 | 50 | @Deprecated |
49 | 51 | public final class GHCheckRunBuilder { |
50 | 52 |
|
51 | | - private final GHRepository repo; |
52 | | - private final Requester requester; |
| 53 | + protected final GHRepository repo; |
| 54 | + protected final Requester requester; |
53 | 55 | private Output output; |
54 | 56 | private List<Action> actions; |
55 | 57 |
|
56 | | - GHCheckRunBuilder(GHRepository repo, String name, String headSHA) { |
| 58 | + private GHCheckRunBuilder(GHRepository repo, Requester requester) { |
57 | 59 | 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))); |
64 | 79 | } |
65 | 80 |
|
66 | 81 | public @NonNull GHCheckRunBuilder withDetailsURL(@CheckForNull String detailsURL) { |
|
0 commit comments