Class GithubNotificationConfig
java.lang.Object
org.jenkinsci.plugins.githubautostatus.config.GithubNotificationConfig
Encapsulates the logic of determining GitHub configuration for a build.
- Author:
- Jeff Pearce (GitHub jeffpearce)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.kohsuke.github.GHRepositoryCreates a fresh GHRepository by re-resolving credentials from the Jenkins credentials store.static GithubNotificationConfigConstructs a config object from a Run object.static GithubNotificationConfigConstructs a config object from aRunobject and GitHub builder.Gets the name of the branch for the build.org.kohsuke.github.GHRepositorygetRepo()Gets the GitHub repo for the build.Gets the name of the repo for the build.Gets the repo owner.Gets the SHA for the build
-
Field Details
-
githubBuilder
protected org.kohsuke.github.GitHubBuilder githubBuilder
-
-
Constructor Details
-
GithubNotificationConfig
public GithubNotificationConfig()
-
-
Method Details
-
getShaString
Gets the SHA for the build- Returns:
- the SHA for the build
-
getRepoOwner
Gets the repo owner.- Returns:
- the repo owner
-
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
Gets the name of the repo for the build.- Returns:
- the name of the repo for the build
-
fromRun
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 aRunobject and GitHub builder.- Parameters:
run- the buildgithubBuilder- 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
-