Package org.kohsuke.github
Class GHWorkflowRun
- java.lang.Object
-
- org.kohsuke.github.GHObject
-
- org.kohsuke.github.GHWorkflowRun
-
public class GHWorkflowRun extends GHObject
A workflow run.- Author:
- Guillaume Smet
- See Also:
GHRepository.getWorkflowRun(long)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classGHWorkflowRun.ConclusionThe Enum Conclusion.static classGHWorkflowRun.HeadCommitThe Class HeadCommit.static classGHWorkflowRun.StatusThe Enum Status.
-
Field Summary
-
Fields inherited from class org.kohsuke.github.GHObject
responseHeaderFields
-
-
Constructor Summary
Constructors Constructor Description GHWorkflowRun()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidapprove()Approve the workflow run.voidcancel()Cancel the workflow run.voiddelete()Delete the workflow run.voiddeleteLogs()Delete the logs.<T> TdownloadLogs(InputStreamFunction<T> streamFunction)Downloads the logs.URLgetArtifactsUrl()The artifacts URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifactsURLgetCancelUrl()The cancel URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancelURLgetCheckSuiteUrl()The check suite URL, like https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374GHWorkflowRun.ConclusiongetConclusion()Gets the conclusion of the workflow run.StringgetDisplayTitle()The display title of the workflow run.GHEventgetEvent()The type of event that triggered the build.StringgetHeadBranch()The head branch name the changes are on.GHWorkflowRun.HeadCommitgetHeadCommit()The commit of current head.GHRepositorygetHeadRepository()The repository of current head.StringgetHeadSha()Gets the HEAD SHA.URLgetHtmlUrl()Gets the html url.URLgetJobsUrl()The jobs URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobsURLgetLogsUrl()The logs URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logsStringgetName()The name of the workflow run.List<GHPullRequest>getPullRequests()Gets the pull requests participated in this workflow run.GHRepositorygetRepository()Repository to which the workflow run belongs.URLgetRerunUrl()The rerun URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerunGitHubgetRoot()Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.longgetRunAttempt()The run attempt.longgetRunNumber()The run number.DategetRunStartedAt()When was this run triggered?.GHWorkflowRun.StatusgetStatus()Gets status of the workflow run.longgetWorkflowId()The workflow id.URLgetWorkflowUrl()The workflow URL, like https://api.github.com/repos/octo-org/octo-repo/actions/workflows/159038PagedIterable<GHWorkflowJob>listAllJobs()Returns the list of jobs from all the executions of this workflow run.PagedIterable<GHArtifact>listArtifacts()Lists the artifacts attached to this workflow run.PagedIterable<GHWorkflowJob>listJobs()Returns the list of jobs of this workflow run for the last execution.voidrerun()Rerun the workflow run.-
Methods inherited from class org.kohsuke.github.GHObject
getCreatedAt, getId, getNodeId, getResponseHeaderFields, getUpdatedAt, getUrl, setResponseHeaderFields, toString
-
-
-
-
Method Detail
-
getName
public String getName()
The name of the workflow run.- Returns:
- the name
-
getDisplayTitle
public String getDisplayTitle()
The display title of the workflow run.- Returns:
- the displayTitle
-
getRunNumber
public long getRunNumber()
The run number.- Returns:
- the run number
-
getWorkflowId
public long getWorkflowId()
The workflow id.- Returns:
- the workflow id
-
getRunAttempt
public long getRunAttempt()
The run attempt.- Returns:
- the run attempt
-
getRunStartedAt
public Date getRunStartedAt() throws IOException
When was this run triggered?.- Returns:
- run triggered
- Throws:
IOException- on error
-
getHtmlUrl
public URL getHtmlUrl() throws IOException
Gets the html url.- Specified by:
getHtmlUrlin classGHObject- Returns:
- the html url
- Throws:
IOException- Signals that an I/O exception has occurred.
-
getJobsUrl
public URL getJobsUrl()
The jobs URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobs- Returns:
- the jobs url
-
getLogsUrl
public URL getLogsUrl()
The logs URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logs- Returns:
- the logs url
-
getCheckSuiteUrl
public URL getCheckSuiteUrl()
The check suite URL, like https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374- Returns:
- the check suite url
-
getArtifactsUrl
public URL getArtifactsUrl()
The artifacts URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifacts- Returns:
- the artifacts url
-
getCancelUrl
public URL getCancelUrl()
The cancel URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancel- Returns:
- the cancel url
-
getRerunUrl
public URL getRerunUrl()
The rerun URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerun- Returns:
- the rerun url
-
getWorkflowUrl
public URL getWorkflowUrl()
The workflow URL, like https://api.github.com/repos/octo-org/octo-repo/actions/workflows/159038- Returns:
- the workflow url
-
getHeadBranch
public String getHeadBranch()
The head branch name the changes are on.- Returns:
- head branch name
-
getHeadSha
public String getHeadSha()
Gets the HEAD SHA.- Returns:
- sha for the HEAD commit
-
getHeadCommit
public GHWorkflowRun.HeadCommit getHeadCommit()
The commit of current head.- Returns:
- head commit
-
getHeadRepository
public GHRepository getHeadRepository()
The repository of current head.- Returns:
- head repository
-
getEvent
public GHEvent getEvent()
The type of event that triggered the build.- Returns:
- type of event
-
getStatus
public GHWorkflowRun.Status getStatus()
Gets status of the workflow run.Can be
UNKNOWNif the value returned by GitHub is unknown from the API.- Returns:
- status of the workflow run
-
getConclusion
public GHWorkflowRun.Conclusion getConclusion()
Gets the conclusion of the workflow run.Can be
UNKNOWNif the value returned by GitHub is unknown from the API.- Returns:
- conclusion of the workflow run
-
getRepository
public GHRepository getRepository()
Repository to which the workflow run belongs.- Returns:
- the repository
-
getPullRequests
public List<GHPullRequest> getPullRequests() throws IOException
Gets the pull requests participated in this workflow run. Note this field is only populated for events. When getting aGHWorkflowRunoutside of an event, this is always empty.- Returns:
- the list of
GHPullRequests for this workflow run. Only populated for events. - Throws:
IOException- the io exception
-
cancel
public void cancel() throws IOExceptionCancel the workflow run.- Throws:
IOException- the io exception
-
delete
public void delete() throws IOExceptionDelete the workflow run.- Throws:
IOException- the io exception
-
rerun
public void rerun() throws IOExceptionRerun the workflow run.- Throws:
IOException- the io exception
-
approve
public void approve() throws IOExceptionApprove the workflow run.- Throws:
IOException- the io exception
-
listArtifacts
public PagedIterable<GHArtifact> listArtifacts()
Lists the artifacts attached to this workflow run.- Returns:
- the paged iterable
-
downloadLogs
public <T> T downloadLogs(InputStreamFunction<T> streamFunction) throws IOException
Downloads the logs.The logs are in the form of a zip archive.
Note that the archive is the same as the one downloaded from a workflow run so it contains the logs for all jobs.
- Type Parameters:
T- the type of result- Parameters:
streamFunction- TheInputStreamFunctionthat will process the stream- Returns:
- the result of reading the stream.
- Throws:
IOException- The IO exception.
-
deleteLogs
public void deleteLogs() throws IOExceptionDelete the logs.- Throws:
IOException- the io exception
-
listJobs
public PagedIterable<GHWorkflowJob> listJobs()
Returns the list of jobs of this workflow run for the last execution.- Returns:
- list of jobs from the last execution
-
listAllJobs
public PagedIterable<GHWorkflowJob> listAllJobs()
Returns the list of jobs from all the executions of this workflow run.- Returns:
- list of jobs from all the executions
-
getRoot
@Deprecated public GitHub getRoot()
Deprecated.For access to theGitHubinstance, use a local copy instead of pulling it out of objects.Get the rootGitHubinstance for this object.- Returns:
- the root
GitHubinstance
-
-