mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
296 lines
10 KiB
HTML
296 lines
10 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>GHCheckRun.java</title><link rel="stylesheet" href="../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">GitHub API for Java</a> > <a href="index.source.html" class="el_package">org.kohsuke.github</a> > <span class="el_source">GHCheckRun.java</span></div><h1>GHCheckRun.java</h1><pre class="source lang-java linenums">package org.kohsuke.github;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|
|
|
import java.io.IOException;
|
|
import java.net.URL;
|
|
import java.util.Arrays;
|
|
import java.util.Collections;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 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")
|
|
<span class="fc" id="L20">public class GHCheckRun extends GHObject {</span>
|
|
|
|
@JsonProperty("repository")
|
|
GHRepository owner;
|
|
GitHub root;
|
|
|
|
private String status;
|
|
private String conclusion;
|
|
private String name;
|
|
private String headSha;
|
|
private String nodeId;
|
|
private String externalId;
|
|
private String startedAt;
|
|
private String completedAt;
|
|
private URL htmlUrl;
|
|
private URL detailsUrl;
|
|
private Output output;
|
|
private GHApp app;
|
|
private GHPullRequest[] pullRequests;
|
|
private GHCheckSuite checkSuite;
|
|
|
|
GHCheckRun wrap(GHRepository owner) {
|
|
<span class="fc" id="L42"> this.owner = owner;</span>
|
|
<span class="fc" id="L43"> wrap(owner.root);</span>
|
|
<span class="fc" id="L44"> return this;</span>
|
|
}
|
|
|
|
GHCheckRun wrap(GitHub root) {
|
|
<span class="fc" id="L48"> this.root = root;</span>
|
|
<span class="fc bfc" id="L49" title="All 2 branches covered."> if (owner != null) {</span>
|
|
<span class="fc" id="L50"> owner.wrap(root);</span>
|
|
<span class="pc bpc" id="L51" title="1 of 4 branches missed."> if (pullRequests != null && pullRequests.length != 0) {</span>
|
|
<span class="fc bfc" id="L52" title="All 2 branches covered."> for (GHPullRequest singlePull : pullRequests) {</span>
|
|
<span class="fc" id="L53"> singlePull.wrap(owner);</span>
|
|
}
|
|
}
|
|
|
|
}
|
|
<span class="pc bpc" id="L58" title="1 of 2 branches missed."> if (checkSuite != null) {</span>
|
|
<span class="fc bfc" id="L59" title="All 2 branches covered."> if (owner != null) {</span>
|
|
<span class="fc" id="L60"> checkSuite.wrap(owner);</span>
|
|
} else {
|
|
<span class="fc" id="L62"> checkSuite.wrap(root);</span>
|
|
}
|
|
}
|
|
<span class="pc bpc" id="L65" title="1 of 2 branches missed."> if (app != null) {</span>
|
|
<span class="fc" id="L66"> app.wrapUp(root);</span>
|
|
}
|
|
|
|
<span class="fc" id="L69"> return this;</span>
|
|
}
|
|
|
|
GHPullRequest[] wrap() {
|
|
<span class="nc" id="L73"> return pullRequests;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets status of the check run.
|
|
*
|
|
* @return Status of the check run
|
|
* @see Status
|
|
*/
|
|
public String getStatus() {
|
|
<span class="fc" id="L83"> return status;</span>
|
|
}
|
|
|
|
<span class="fc" id="L86"> public static enum Status {</span>
|
|
<span class="fc" id="L87"> QUEUED, IN_PROGRESS, COMPLETED</span>
|
|
}
|
|
|
|
/**
|
|
* Gets conclusion of a completed check run.
|
|
*
|
|
* @return Status of the check run
|
|
* @see Conclusion
|
|
*/
|
|
public String getConclusion() {
|
|
<span class="fc" id="L97"> return conclusion;</span>
|
|
}
|
|
|
|
/**
|
|
* Final conclusion of the check.
|
|
*
|
|
* From <a href="https://docs.github.com/en/rest/reference/checks#create-a-check-run--parameters">Check Run
|
|
* Parameters - <code>conclusion</code></a>.
|
|
*/
|
|
<span class="fc" id="L106"> public static enum Conclusion {</span>
|
|
<span class="fc" id="L107"> SUCCESS, FAILURE, NEUTRAL, CANCELLED, TIMED_OUT, ACTION_REQUIRED, SKIPPED</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the custom name of this check run.
|
|
*
|
|
* @return Name of the check run
|
|
*/
|
|
public String getName() {
|
|
<span class="fc" id="L116"> return name;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the HEAD SHA.
|
|
*
|
|
* @return sha for the HEAD commit
|
|
*/
|
|
public String getHeadSha() {
|
|
<span class="fc" id="L125"> return headSha;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the pull requests participated in this check run.
|
|
*
|
|
* Note this field is only populated for events. When getting a {@link GHCheckRun} outside of an event, this is
|
|
* always empty.
|
|
*
|
|
* @return the list of {@link GHPullRequest}s for this check run. Only populated for events.
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public List<GHPullRequest> getPullRequests() throws IOException {
|
|
<span class="pc bpc" id="L139" title="2 of 4 branches missed."> if (pullRequests != null && pullRequests.length != 0) {</span>
|
|
<span class="fc bfc" id="L140" title="All 2 branches covered."> for (GHPullRequest singlePull : pullRequests) {</span>
|
|
// Only refresh if we haven't do so before
|
|
<span class="fc" id="L142"> singlePull.refresh(singlePull.getTitle());</span>
|
|
}
|
|
<span class="fc" id="L144"> return Collections.unmodifiableList(Arrays.asList(pullRequests));</span>
|
|
}
|
|
<span class="nc" id="L146"> return Collections.emptyList();</span>
|
|
}
|
|
|
|
/**
|
|
* 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() {
|
|
<span class="fc" id="L157"> return htmlUrl;</span>
|
|
}
|
|
|
|
/**
|
|
* 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() {
|
|
<span class="fc" id="L167"> return nodeId;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets a reference for the check run on the integrator's system.
|
|
*
|
|
* @return Reference id
|
|
*/
|
|
public String getExternalId() {
|
|
<span class="fc" id="L176"> return externalId;</span>
|
|
}
|
|
|
|
/**
|
|
* 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() {
|
|
<span class="fc" id="L185"> return detailsUrl;</span>
|
|
}
|
|
|
|
/**
|
|
* 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() {
|
|
<span class="fc" id="L194"> return GitHubClient.parseDate(startedAt);</span>
|
|
}
|
|
|
|
/**
|
|
* 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() {
|
|
<span class="fc" id="L203"> return GitHubClient.parseDate(completedAt);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the GitHub app this check run belongs to, included in response.
|
|
*
|
|
* @return GitHub App
|
|
*/
|
|
public GHApp getApp() {
|
|
<span class="fc" id="L212"> return app;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the check suite this check run belongs to
|
|
*
|
|
* @return Check suite
|
|
*/
|
|
public GHCheckSuite getCheckSuite() {
|
|
<span class="fc" id="L221"> return checkSuite;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets an output for a check run.
|
|
*
|
|
* @return Output of a check run
|
|
*/
|
|
public Output getOutput() {
|
|
<span class="fc" id="L230"> return output;</span>
|
|
}
|
|
|
|
/**
|
|
* 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>
|
|
*/
|
|
<span class="fc" id="L238"> public static class Output {</span>
|
|
private String title;
|
|
private String summary;
|
|
private String text;
|
|
private int annotationsCount;
|
|
private URL annotationsUrl;
|
|
|
|
/**
|
|
* Gets the title of check run.
|
|
*
|
|
* @return title of check run
|
|
*/
|
|
public String getTitle() {
|
|
<span class="fc" id="L251"> return title;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the summary of the check run, note that it supports Markdown.
|
|
*
|
|
* @return summary of check run
|
|
*/
|
|
public String getSummary() {
|
|
<span class="fc" id="L260"> return summary;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the details of the check run, note that it supports Markdown.
|
|
*
|
|
* @return Details of the check run
|
|
*/
|
|
public String getText() {
|
|
<span class="fc" id="L269"> return text;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the annotation count of a check run.
|
|
*
|
|
* @return annotation count of a check run
|
|
*/
|
|
public int getAnnotationsCount() {
|
|
<span class="fc" id="L278"> return annotationsCount;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the URL of annotations.
|
|
*
|
|
* @return URL of annotations
|
|
*/
|
|
public URL getAnnotationsUrl() {
|
|
<span class="fc" id="L287"> return annotationsUrl;</span>
|
|
}
|
|
}
|
|
|
|
<span class="fc" id="L291"> public static enum AnnotationLevel {</span>
|
|
<span class="fc" id="L292"> NOTICE, WARNING, FAILURE</span>
|
|
}
|
|
|
|
}
|
|
</pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.5.201910111838</span></div></body></html> |