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:
  • Constructor Details

    • GHWorkflowRun

      public GHWorkflowRun()
      Create default GHWorkflowRun instance
  • Method Details

    • 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.
      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 a GHWorkflowRun outside 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 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 - The InputStreamFunction 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