4
4
5
5
import java .io .IOException ;
6
6
import java .net .URL ;
7
+ import java .util .Date ;
7
8
8
9
/**
9
10
* Represents a check run.
10
11
*
11
12
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
12
13
*/
13
-
14
14
@ SuppressFBWarnings (value = { "UWF_UNWRITTEN_FIELD" , "NP_UNWRITTEN_FIELD" , "URF_UNREAD_FIELD" },
15
15
justification = "JSON API" )
16
16
public class GHCheckRun extends GHObject {
@@ -21,7 +21,16 @@ public class GHCheckRun extends GHObject {
21
21
private String conclusion ;
22
22
private String name ;
23
23
private String headSha ;
24
+ private String nodeId ;
25
+ private String externalId ;
26
+ private String startedAt ;
27
+ private String completedAt ;
28
+ private URL htmlUrl ;
29
+ private URL detailsUrl ;
30
+ private Output output ;
31
+ private GHApp app ;
24
32
private GHPullRequest [] pullRequests ;
33
+ private GHCheckSuite checkSuite ;
25
34
26
35
GHCheckRun wrap (GHRepository owner ) {
27
36
this .owner = owner ;
@@ -41,14 +50,30 @@ GHPullRequest[] wrap() {
41
50
return pullRequests ;
42
51
}
43
52
53
+ /**
54
+ * Gets status of the check run. It can be one of "queue", "in_progress", or "completed"
55
+ *
56
+ * @return Status of the check run
57
+ */
44
58
public String getStatus () {
45
59
return status ;
46
60
}
47
61
62
+ /**
63
+ * Gets conclusion of a completed check run. It can be one of "success", "failure", "neutral", "cancelled",
64
+ * "time_out", or "action_required".
65
+ *
66
+ * @return Status of the check run
67
+ */
48
68
public String getConclusion () {
49
69
return conclusion ;
50
70
}
51
71
72
+ /**
73
+ * Gets the custom name of this check run.
74
+ *
75
+ * @return Name of the check run
76
+ */
52
77
public String getName () {
53
78
return name ;
54
79
}
@@ -62,6 +87,11 @@ public String getHeadSha() {
62
87
return headSha ;
63
88
}
64
89
90
+ /**
91
+ * Gets the pull requests participated in this check run.
92
+ *
93
+ * @return Pull requests of this check run
94
+ */
65
95
GHPullRequest [] getPullRequests () throws IOException {
66
96
if (pullRequests != null && pullRequests .length != 0 ) {
67
97
for (GHPullRequest singlePull : pullRequests ) {
@@ -72,11 +102,145 @@ GHPullRequest[] getPullRequests() throws IOException {
72
102
}
73
103
74
104
/**
75
- * @deprecated This object has no HTML URL.
105
+ * Gets the HTML URL: https://github.com/[owner]/[repo-name]/runs/[check-run-id], usually an GitHub Action page of
106
+ * the check run.
107
+ *
108
+ * @return HTML URL
76
109
*/
77
110
@ Override
78
111
public URL getHtmlUrl () {
79
- return null ;
112
+ return htmlUrl ;
113
+ }
114
+
115
+ /**
116
+ * Gets the global node id to access most objects in GitHub.
117
+ *
118
+ * @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">documentation</a>
119
+ * @return Global node id
120
+ */
121
+ public String getNodeId () {
122
+ return nodeId ;
123
+ }
124
+
125
+ /**
126
+ * Gets a reference for the check run on the integrator's system.
127
+ *
128
+ * @return Reference id
129
+ */
130
+ public String getExternalId () {
131
+ return externalId ;
132
+ }
133
+
134
+ /**
135
+ * Gets the details URL from which to find full details of the check run on the integrator's site.
136
+ *
137
+ * @return Details URL
138
+ */
139
+ public URL getDetailsUrl () {
140
+ return detailsUrl ;
141
+ }
142
+
143
+ /**
144
+ * Gets the start time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
145
+ *
146
+ * @return Timestamp of the start time
147
+ */
148
+ public Date getStartedAt () {
149
+ return GitHubClient .parseDate (startedAt );
150
+ }
151
+
152
+ /**
153
+ * Gets the completed time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
154
+ *
155
+ * @return Timestamp of the completed time
156
+ */
157
+ public Date getCompletedAt () {
158
+ return GitHubClient .parseDate (completedAt );
159
+ }
160
+
161
+ /**
162
+ * Gets the GitHub app this check run belongs to, included in response.
163
+ *
164
+ * @return GitHub App
165
+ */
166
+ public GHApp getApp () {
167
+ return app ;
168
+ }
169
+
170
+ /**
171
+ * Gets the check suite this check run belongs to
172
+ *
173
+ * @return Check suite
174
+ */
175
+ public GHCheckSuite getCheckSuite () {
176
+ return checkSuite ;
177
+ }
178
+
179
+ /**
180
+ * Gets an output for a check run.
181
+ *
182
+ * @return Output of a check run
183
+ */
184
+ public Output getOutput () {
185
+ return output ;
186
+ }
187
+
188
+ /**
189
+ * Represents an output in a check run to include summary and other results.
190
+ *
191
+ * @see <a href="https://developer.github.com/v3/checks/runs/#output-object">documentation</a>
192
+ */
193
+ public static class Output {
194
+ private String title ;
195
+ private String summary ;
196
+ private String text ;
197
+ private int annotationsCount ;
198
+ private URL annotationsUrl ;
199
+
200
+ /**
201
+ * Gets the title of check run.
202
+ *
203
+ * @return title of check run
204
+ */
205
+ public String getTitle () {
206
+ return title ;
207
+ }
208
+
209
+ /**
210
+ * Gets the summary of the check run, note that it supports Markdown.
211
+ *
212
+ * @return summary of check run
213
+ */
214
+ public String getSummary () {
215
+ return summary ;
216
+ }
217
+
218
+ /**
219
+ * Gets the details of the check run, note that it supports Markdown.
220
+ *
221
+ * @return Details of the check run
222
+ */
223
+ public String getText () {
224
+ return text ;
225
+ }
226
+
227
+ /**
228
+ * Gets the annotation count of a check run.
229
+ *
230
+ * @return annotation count of a check run
231
+ */
232
+ public int getAnnotationsCount () {
233
+ return annotationsCount ;
234
+ }
235
+
236
+ /**
237
+ * Gets the URL of annotations.
238
+ *
239
+ * @return URL of annotations
240
+ */
241
+ public URL getAnnotationsUrl () {
242
+ return annotationsUrl ;
243
+ }
80
244
}
81
245
82
246
}
0 commit comments