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 class
GHWorkflowRun.Conclusion
The Enum Conclusion.static class
GHWorkflowRun.HeadCommit
The Class HeadCommit.static class
GHWorkflowRun.Status
The 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 void
approve()
Approve the workflow run.void
cancel()
Cancel the workflow run.void
delete()
Delete the workflow run.void
deleteLogs()
Delete the logs.<T> T
downloadLogs(InputStreamFunction<T> streamFunction)
Downloads the logs.URL
getArtifactsUrl()
The artifacts URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/artifactsURL
getCancelUrl()
The cancel URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/cancelURL
getCheckSuiteUrl()
The check suite URL, like https://api.github.com/repos/octo-org/octo-repo/check-suites/414944374GHWorkflowRun.Conclusion
getConclusion()
Gets the conclusion of the workflow run.String
getDisplayTitle()
The display title of the workflow run.GHEvent
getEvent()
The type of event that triggered the build.String
getHeadBranch()
The head branch name the changes are on.GHWorkflowRun.HeadCommit
getHeadCommit()
The commit of current head.GHRepository
getHeadRepository()
The repository of current head.String
getHeadSha()
Gets the HEAD SHA.URL
getHtmlUrl()
Gets the html url.URL
getJobsUrl()
The jobs URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/jobsURL
getLogsUrl()
The logs URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/logsString
getName()
The name of the workflow run.List<GHPullRequest>
getPullRequests()
Gets the pull requests participated in this workflow run.GHRepository
getRepository()
Repository to which the workflow run belongs.URL
getRerunUrl()
The rerun URL, like https://api.github.com/repos/octo-org/octo-repo/actions/runs/30433642/rerunGitHub
getRoot()
Deprecated.For access to theGitHub
instance, use a local copy instead of pulling it out of objects.long
getRunAttempt()
The run attempt.long
getRunNumber()
The run number.Date
getRunStartedAt()
When was this run triggered?.GHWorkflowRun.Status
getStatus()
Gets status of the workflow run.long
getWorkflowId()
The workflow id.URL
getWorkflowUrl()
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.void
rerun()
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:
getHtmlUrl
in 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
UNKNOWN
if 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
UNKNOWN
if 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 aGHWorkflowRun
outside of an event, this is always empty.- Returns:
- the list of
GHPullRequest
s for this workflow run. Only populated for events. - Throws:
IOException
- the io exception
-
cancel
public void cancel() throws IOException
Cancel the workflow run.- Throws:
IOException
- the io exception
-
delete
public void delete() throws IOException
Delete the workflow run.- Throws:
IOException
- the io exception
-
rerun
public void rerun() throws IOException
Rerun the workflow run.- Throws:
IOException
- the io exception
-
approve
public void approve() throws IOException
Approve 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
- TheInputStreamFunction
that will process the stream- Returns:
- the result of reading the stream.
- Throws:
IOException
- The IO exception.
-
deleteLogs
public void deleteLogs() throws IOException
Delete 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 theGitHub
instance, use a local copy instead of pulling it out of objects.Get the rootGitHub
instance for this object.- Returns:
- the root
GitHub
instance
-
-