mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
261 lines
9.1 KiB
HTML
261 lines
9.1 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>GHCheckSuite.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">GHCheckSuite.java</span></div><h1>GHCheckSuite.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 suite.
|
|
*
|
|
* @see <a href="https://developer.github.com/v3/checks/suites/">documentation</a>
|
|
*/
|
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" },
|
|
justification = "JSON API")
|
|
<span class="fc" id="L20">public class GHCheckSuite extends GHObject {</span>
|
|
|
|
@JsonProperty("repository")
|
|
GHRepository owner;
|
|
GitHub root;
|
|
|
|
private String nodeId;
|
|
private String headBranch;
|
|
private String headSha;
|
|
private String status;
|
|
private String conclusion;
|
|
private String before;
|
|
private String after;
|
|
private int latestCheckRunsCount;
|
|
private URL checkRunsUrl;
|
|
private HeadCommit headCommit;
|
|
private GHApp app;
|
|
private GHPullRequest[] pullRequests;
|
|
|
|
GHCheckSuite wrap(GHRepository owner) {
|
|
<span class="fc" id="L40"> this.owner = owner;</span>
|
|
<span class="fc" id="L41"> this.wrap(owner.root);</span>
|
|
<span class="fc" id="L42"> return this;</span>
|
|
}
|
|
|
|
GHCheckSuite wrap(GitHub root) {
|
|
<span class="fc" id="L46"> this.root = root;</span>
|
|
<span class="fc bfc" id="L47" title="All 2 branches covered."> if (owner != null) {</span>
|
|
<span class="fc" id="L48"> owner.wrap(root);</span>
|
|
<span class="pc bpc" id="L49" title="1 of 4 branches missed."> if (pullRequests != null && pullRequests.length != 0) {</span>
|
|
<span class="fc bfc" id="L50" title="All 2 branches covered."> for (GHPullRequest singlePull : pullRequests) {</span>
|
|
<span class="fc" id="L51"> singlePull.wrap(owner);</span>
|
|
}
|
|
}
|
|
}
|
|
<span class="fc bfc" id="L55" title="All 2 branches covered."> if (app != null) {</span>
|
|
<span class="fc" id="L56"> app.wrapUp(root);</span>
|
|
}
|
|
<span class="fc" id="L58"> return this;</span>
|
|
}
|
|
|
|
GHPullRequest[] wrap() {
|
|
<span class="nc" id="L62"> return pullRequests;</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="L72"> return nodeId;</span>
|
|
}
|
|
|
|
/**
|
|
* The head branch name the changes are on.
|
|
*
|
|
* @return head branch name
|
|
*/
|
|
public String getHeadBranch() {
|
|
<span class="fc" id="L81"> return headBranch;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the HEAD SHA.
|
|
*
|
|
* @return sha for the HEAD commit
|
|
*/
|
|
public String getHeadSha() {
|
|
<span class="fc" id="L90"> return headSha;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets status of the check suite. It can be one of request, in_progress, or completed.
|
|
*
|
|
* @return status of the check suite
|
|
*/
|
|
public String getStatus() {
|
|
<span class="fc" id="L99"> return status;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets conclusion of a completed check suite. It can be one of success, failure, neutral, cancelled, time_out,
|
|
* action_required, or stale. The check suite will report the highest priority check run conclusion in the check
|
|
* suite's conclusion.
|
|
*
|
|
* @return conclusion of the check suite
|
|
*/
|
|
public String getConclusion() {
|
|
<span class="fc" id="L110"> return conclusion;</span>
|
|
}
|
|
|
|
/**
|
|
* The SHA of the most recent commit on ref before the push.
|
|
*
|
|
* @return sha of a commit
|
|
*/
|
|
public String getBefore() {
|
|
<span class="fc" id="L119"> return before;</span>
|
|
}
|
|
|
|
/**
|
|
* The SHA of the most recent commit on ref after the push.
|
|
*
|
|
* @return sha of a commit
|
|
*/
|
|
public String getAfter() {
|
|
<span class="fc" id="L128"> return after;</span>
|
|
}
|
|
|
|
/**
|
|
* The quantity of check runs that had run as part of the latest push.
|
|
*
|
|
* @return sha of the most recent commit
|
|
*/
|
|
public int getLatestCheckRunsCount() {
|
|
<span class="fc" id="L137"> return latestCheckRunsCount;</span>
|
|
}
|
|
|
|
/**
|
|
* The url used to list all the check runs belonged to this suite.
|
|
*
|
|
* @return url containing all check runs
|
|
*/
|
|
public URL getCheckRunsUrl() {
|
|
<span class="fc" id="L146"> return checkRunsUrl;</span>
|
|
}
|
|
|
|
/**
|
|
* The commit of current head.
|
|
*
|
|
* @return head commit
|
|
*/
|
|
public HeadCommit getHeadCommit() {
|
|
<span class="fc" id="L155"> return headCommit;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the GitHub app this check suite belongs to, included in response.
|
|
*
|
|
* @return GitHub App
|
|
*/
|
|
public GHApp getApp() {
|
|
<span class="fc" id="L164"> return app;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets the pull requests participated in this check suite.
|
|
*
|
|
* Note this field is only populated for events. When getting a {@link GHCheckSuite} outside of an event, this is
|
|
* always empty.
|
|
*
|
|
* @return the list of {@link GHPullRequest}s for this check suite. Only populated for events.
|
|
* @throws IOException
|
|
* the io exception
|
|
*/
|
|
public List<GHPullRequest> getPullRequests() throws IOException {
|
|
<span class="pc bpc" id="L178" title="2 of 4 branches missed."> if (pullRequests != null && pullRequests.length != 0) {</span>
|
|
<span class="fc bfc" id="L179" title="All 2 branches covered."> for (GHPullRequest singlePull : pullRequests) {</span>
|
|
// Only refresh if we haven't do so before
|
|
<span class="fc" id="L181"> singlePull.refresh(singlePull.getTitle());</span>
|
|
}
|
|
<span class="fc" id="L183"> return Collections.unmodifiableList(Arrays.asList(pullRequests));</span>
|
|
}
|
|
<span class="nc" id="L185"> return Collections.emptyList();</span>
|
|
}
|
|
|
|
/**
|
|
* Check suite doesn't have a HTML URL.
|
|
*
|
|
* @return null
|
|
*/
|
|
@Override
|
|
public URL getHtmlUrl() {
|
|
<span class="nc" id="L195"> return null;</span>
|
|
}
|
|
|
|
<span class="fc" id="L198"> public static class HeadCommit {</span>
|
|
private String id;
|
|
private String treeId;
|
|
private String message;
|
|
private String timestamp;
|
|
private GitUser author;
|
|
private GitUser committer;
|
|
|
|
/**
|
|
* Gets id of the commit, used by {@link GHCheckSuite} when a {@link GHEvent#CHECK_SUITE} comes
|
|
*
|
|
* @return id of the commit
|
|
*/
|
|
public String getId() {
|
|
<span class="fc" id="L212"> return id;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets id of the tree.
|
|
*
|
|
* @return id of the tree
|
|
*/
|
|
public String getTreeId() {
|
|
<span class="fc" id="L221"> return treeId;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets message.
|
|
*
|
|
* @return commit message.
|
|
*/
|
|
public String getMessage() {
|
|
<span class="fc" id="L230"> return message;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets timestamp of the commit.
|
|
*
|
|
* @return timestamp of the commit
|
|
*/
|
|
public Date getTimestamp() {
|
|
<span class="fc" id="L239"> return GitHubClient.parseDate(timestamp);</span>
|
|
}
|
|
|
|
/**
|
|
* Gets author.
|
|
*
|
|
* @return the author
|
|
*/
|
|
public GitUser getAuthor() {
|
|
<span class="fc" id="L248"> return author;</span>
|
|
}
|
|
|
|
/**
|
|
* Gets committer.
|
|
*
|
|
* @return the committer
|
|
*/
|
|
public GitUser getCommitter() {
|
|
<span class="fc" id="L257"> return committer;</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> |