44
55import java .io .IOException ;
66import java .net .URL ;
7+ import java .util .Date ;
78
89/**
910 * Represents a check run.
1011 *
1112 * @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
1213 */
13-
1414@ SuppressFBWarnings (value = { "UWF_UNWRITTEN_FIELD" , "NP_UNWRITTEN_FIELD" , "URF_UNREAD_FIELD" },
1515 justification = "JSON API" )
1616public class GHCheckRun extends GHObject {
@@ -21,7 +21,16 @@ public class GHCheckRun extends GHObject {
2121 private String conclusion ;
2222 private String name ;
2323 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 ;
2432 private GHPullRequest [] pullRequests ;
33+ private GHCheckSuite checkSuite ;
2534
2635 GHCheckRun wrap (GHRepository owner ) {
2736 this .owner = owner ;
@@ -41,14 +50,30 @@ GHPullRequest[] wrap() {
4150 return pullRequests ;
4251 }
4352
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+ */
4458 public String getStatus () {
4559 return status ;
4660 }
4761
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+ */
4868 public String getConclusion () {
4969 return conclusion ;
5070 }
5171
72+ /**
73+ * Gets the custom name of this check run.
74+ *
75+ * @return Name of the check run
76+ */
5277 public String getName () {
5378 return name ;
5479 }
@@ -62,6 +87,11 @@ public String getHeadSha() {
6287 return headSha ;
6388 }
6489
90+ /**
91+ * Gets the pull requests participated in this check run.
92+ *
93+ * @return Pull requests of this check run
94+ */
6595 GHPullRequest [] getPullRequests () throws IOException {
6696 if (pullRequests != null && pullRequests .length != 0 ) {
6797 for (GHPullRequest singlePull : pullRequests ) {
@@ -72,11 +102,145 @@ GHPullRequest[] getPullRequests() throws IOException {
72102 }
73103
74104 /**
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
76109 */
77110 @ Override
78111 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+ }
80244 }
81245
82246}
0 commit comments