Class GithubNotificationConfig

java.lang.Object
org.jenkinsci.plugins.githubautostatus.config.GithubNotificationConfig

public class GithubNotificationConfig extends Object
Encapsulates the logic of determining GitHub configuration for a build.
Author:
Jeff Pearce (GitHub jeffpearce)
  • Field Details

    • githubBuilder

      protected org.kohsuke.github.GitHubBuilder githubBuilder
  • Constructor Details

    • GithubNotificationConfig

      public GithubNotificationConfig()
  • Method Details

    • getShaString

      public String getShaString()
      Gets the SHA for the build
      Returns:
      the SHA for the build
    • getRepoOwner

      public String getRepoOwner()
      Gets the repo owner.
      Returns:
      the repo owner
    • getBranchName

      public String getBranchName()
      Gets the name of the branch for the build.
      Returns:
      the name of the branch for the build
    • getRepo

      public org.kohsuke.github.GHRepository getRepo()
      Gets the GitHub repo for the build.
      Returns:
      the GitHub repo for the build
    • getRepoName

      public String getRepoName()
      Gets the name of the repo for the build.
      Returns:
      the name of the repo for the build
    • fromRun

      @Nullable public static GithubNotificationConfig fromRun(Run<?,?> run)
      Constructs a config object from a Run object.
      Parameters:
      run - the build
      Returns:
      the GitHub config object
    • fromRun

      @Nullable public static GithubNotificationConfig fromRun(Run<?,?> run, org.kohsuke.github.GitHubBuilder githubBuilder)
      Constructs a config object from a Run object and GitHub builder.
      Parameters:
      run - the build
      githubBuilder - the GitHub builder
      Returns:
      the constructed config object
    • createRepository

      @Nullable public org.kohsuke.github.GHRepository createRepository()
      Creates a fresh GHRepository by re-resolving credentials from the Jenkins credentials store. This is necessary because GitHub App tokens have a non-configurable TTL of 60 minutes, and builds that run longer than that will fail to update commit statuses with the original token.
      Returns:
      a fresh GHRepository, or null if credentials could not be resolved