-
Notifications
You must be signed in to change notification settings - Fork 753
Complete checks api #723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete checks api #723
Changes from all commits
10cc79f
05e8148
73179c1
2242174
e96067e
5a8f8c3
57f9475
f9006af
10b01ca
3754175
16faaae
f8a8ee9
f54bfd3
ce7cfc0
768f607
d0b23c7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,13 +4,13 @@ | |
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.Date; | ||
|
||
/** | ||
* Represents a check run. | ||
* | ||
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a> | ||
*/ | ||
|
||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" }, | ||
justification = "JSON API") | ||
public class GHCheckRun extends GHObject { | ||
|
@@ -21,7 +21,16 @@ public class GHCheckRun extends GHObject { | |
private String conclusion; | ||
private String name; | ||
private String headSha; | ||
private String nodeId; | ||
private String externalId; | ||
private String startedAt; | ||
private String completedAt; | ||
private URL htmlUrl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can inherit the |
||
private URL detailsUrl; | ||
private Output output; | ||
private GHApp app; | ||
private GHPullRequest[] pullRequests; | ||
private GHCheckSuite checkSuite; | ||
|
||
GHCheckRun wrap(GHRepository owner) { | ||
this.owner = owner; | ||
|
@@ -41,14 +50,30 @@ GHPullRequest[] wrap() { | |
return pullRequests; | ||
} | ||
|
||
/** | ||
* Gets status of the check run. It can be one of "queue", "in_progress", or "completed" | ||
* | ||
* @return Status of the check run | ||
*/ | ||
public String getStatus() { | ||
return status; | ||
} | ||
|
||
/** | ||
* Gets conclusion of a completed check run. It can be one of "success", "failure", "neutral", "cancelled", | ||
* "time_out", or "action_required". | ||
* | ||
* @return Status of the check run | ||
*/ | ||
public String getConclusion() { | ||
return conclusion; | ||
} | ||
|
||
/** | ||
* Gets the custom name of this check run. | ||
* | ||
* @return Name of the check run | ||
*/ | ||
public String getName() { | ||
return name; | ||
} | ||
|
@@ -62,6 +87,11 @@ public String getHeadSha() { | |
return headSha; | ||
} | ||
|
||
/** | ||
* Gets the pull requests participated in this check run. | ||
* | ||
* @return Pull requests of this check run | ||
*/ | ||
GHPullRequest[] getPullRequests() throws IOException { | ||
if (pullRequests != null && pullRequests.length != 0) { | ||
for (GHPullRequest singlePull : pullRequests) { | ||
|
@@ -72,11 +102,145 @@ GHPullRequest[] getPullRequests() throws IOException { | |
} | ||
|
||
/** | ||
* @deprecated This object has no HTML URL. | ||
* Gets the HTML URL: https://github.com/[owner]/[repo-name]/runs/[check-run-id], usually an GitHub Action page of | ||
* the check run. | ||
* | ||
* @return HTML URL | ||
*/ | ||
@Override | ||
public URL getHtmlUrl() { | ||
return null; | ||
return htmlUrl; | ||
} | ||
|
||
/** | ||
* Gets the global node id to access most objects in GitHub. | ||
* | ||
* @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">documentation</a> | ||
* @return Global node id | ||
*/ | ||
public String getNodeId() { | ||
return nodeId; | ||
} | ||
|
||
/** | ||
* Gets a reference for the check run on the integrator's system. | ||
* | ||
* @return Reference id | ||
*/ | ||
public String getExternalId() { | ||
return externalId; | ||
} | ||
|
||
/** | ||
* Gets the details URL from which to find full details of the check run on the integrator's site. | ||
* | ||
* @return Details URL | ||
*/ | ||
public URL getDetailsUrl() { | ||
return detailsUrl; | ||
} | ||
|
||
/** | ||
* Gets the start time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. | ||
* | ||
* @return Timestamp of the start time | ||
*/ | ||
public Date getStartedAt() { | ||
return GitHubClient.parseDate(startedAt); | ||
} | ||
|
||
/** | ||
* Gets the completed time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ. | ||
* | ||
* @return Timestamp of the completed time | ||
*/ | ||
public Date getCompletedAt() { | ||
return GitHubClient.parseDate(completedAt); | ||
} | ||
|
||
/** | ||
* Gets the GitHub app this check run belongs to, included in response. | ||
* | ||
* @return GitHub App | ||
*/ | ||
public GHApp getApp() { | ||
return app; | ||
} | ||
|
||
/** | ||
* Gets the check suite this check run belongs to | ||
* | ||
* @return Check suite | ||
*/ | ||
public GHCheckSuite getCheckSuite() { | ||
return checkSuite; | ||
} | ||
|
||
/** | ||
* Gets an output for a check run. | ||
* | ||
* @return Output of a check run | ||
*/ | ||
public Output getOutput() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need the javadoc for this. |
||
return output; | ||
} | ||
|
||
/** | ||
* Represents an output in a check run to include summary and other results. | ||
* | ||
* @see <a href="https://developer.github.com/v3/checks/runs/#output-object">documentation</a> | ||
*/ | ||
public static class Output { | ||
private String title; | ||
private String summary; | ||
private String text; | ||
private int annotationsCount; | ||
private URL annotationsUrl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's where I'm confused. The response (or event payload) from GitHub does not include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most probably it should support. Would be beneficial for users in the longer term There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It isn't required for this PR, I'm just noting it for later. |
||
|
||
/** | ||
* Gets the title of check run. | ||
* | ||
* @return title of check run | ||
*/ | ||
public String getTitle() { | ||
return title; | ||
} | ||
|
||
/** | ||
* Gets the summary of the check run, note that it supports Markdown. | ||
* | ||
* @return summary of check run | ||
*/ | ||
public String getSummary() { | ||
return summary; | ||
} | ||
|
||
/** | ||
* Gets the details of the check run, note that it supports Markdown. | ||
* | ||
* @return Details of the check run | ||
*/ | ||
public String getText() { | ||
return text; | ||
} | ||
|
||
/** | ||
* Gets the annotation count of a check run. | ||
* | ||
* @return annotation count of a check run | ||
*/ | ||
public int getAnnotationsCount() { | ||
return annotationsCount; | ||
} | ||
|
||
/** | ||
* Gets the URL of annotations. | ||
* | ||
* @return URL of annotations | ||
*/ | ||
public URL getAnnotationsUrl() { | ||
return annotationsUrl; | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These can be
Date
instances I think and Jackson will handle the conversion.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just saw the
GHObject
usesString
for such timestamps at first and convert them intoDate
in getters. And I think if we want to get rid of setters, we may have to do it in this way, or we will get error messages from spot-bugs like may expose internal representation.