Class GithubExtension
java.lang.Object
io.github.intisy.gradle.github.extension.GithubExtension
Extension for configuring GitHub integration.
github {
debug = true
auth {
token = "ghp_..." // a Personal Access Token
tokenFile = file("secrets/github.txt") // or a file that contains one
sshKey = file("~/.ssh/id_ed25519") // SSH private key for git clone/pull
}
cli {
enabled = true // route API calls through the local "gh" CLI
fallback = true // fall back to HTTP if gh is unavailable or fails (default)
}
resilience {
skipOnRateLimit = true // degrade gracefully (don't fail) when a GitHub rate limit is hit
}
publish {
owner = "my-org"
repo = "my-repo"
version = "2.0.0"
jar = file("build/libs/my-fat.jar")
}
resources {
repoUrl = "https://github.com/my-org/my-resources"
branch = "main"
}
}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidauth(groovy.lang.Closure<?> closure) Configures the nested auth extension using a Groovy closure.voidauth(org.gradle.api.Action<? super AuthExtension> action) Configures the nested auth extension using a Gradle action.voidcli(groovy.lang.Closure<?> closure) Configures the nested CLI extension using a Groovy closure.voidcli(org.gradle.api.Action<? super CliExtension> action) Configures the nested CLI extension using a Gradle action.Deprecated.getAuth()getCli()booleanisDebug()booleanDeprecated.Replaced by the nestedresilience { skipOnRateLimit = ... }block.booleanisUseCli()Deprecated.Replaced by the nestedcli { enabled = ... }block.voidpublish(groovy.lang.Closure<?> closure) Configures the nested publish extension using a Groovy closure.voidpublish(org.gradle.api.Action<? super PublishExtension> action) Configures the nested publish extension using a Gradle action.voidresilience(groovy.lang.Closure<?> closure) Configures the nested resilience extension using a Groovy closure.voidresilience(org.gradle.api.Action<? super ResilienceExtension> action) Configures the nested resilience extension using a Gradle action.voidresources(groovy.lang.Closure<?> closure) Configures the nested resources extension using a Groovy closure.voidresources(org.gradle.api.Action<? super ResourcesExtension> action) Configures the nested resources extension using a Gradle action.voidsetAccessToken(File accessToken) Deprecated.Replaced by the nestedauth { }block (tokenFile/sshKey).voidsetAccessToken(String accessToken) Deprecated.Replaced by the nestedauth { token = ... }block.voidsetAccessToken(Path accessToken) Deprecated.Replaced by the nestedauth { }block (tokenFile/sshKey).voidsetDebug(boolean debug) voidsetSkipOnRateLimit(boolean skipOnRateLimit) Deprecated.Replaced by the nestedresilience { skipOnRateLimit = ... }block.voidsetUseCli(boolean useCli) Deprecated.Replaced by the nestedcli { enabled = ... }block.
-
Constructor Details
-
GithubExtension
public GithubExtension()
-
-
Method Details
-
setDebug
public void setDebug(boolean debug) - Parameters:
debug- Whether to enable debug logging.
-
isDebug
public boolean isDebug()- Returns:
- Whether debug logging is enabled.
-
getAuth
- Returns:
- the nested auth extension.
-
auth
Configures the nested auth extension using a Gradle action.- Parameters:
action- The configuration action.
-
auth
public void auth(groovy.lang.Closure<?> closure) Configures the nested auth extension using a Groovy closure. Supports Gradle Groovy DSL usage:auth { ... }- Parameters:
closure- The configuration closure.
-
getResilience
- Returns:
- the nested resilience extension.
-
resilience
Configures the nested resilience extension using a Gradle action.- Parameters:
action- The configuration action.
-
resilience
public void resilience(groovy.lang.Closure<?> closure) Configures the nested resilience extension using a Groovy closure. Supports Gradle Groovy DSL usage:resilience { ... }- Parameters:
closure- The configuration closure.
-
setSkipOnRateLimit
Deprecated.Replaced by the nestedresilience { skipOnRateLimit = ... }block. This delegates toResilienceExtension.setSkipOnRateLimit(boolean)and will be removed in a future release.- Parameters:
skipOnRateLimit- whether to degrade gracefully (rather than fail) when the rate limit is hit.
-
isSkipOnRateLimit
Deprecated.Replaced by the nestedresilience { skipOnRateLimit = ... }block. This delegates toResilienceExtension.isSkipOnRateLimit()and will be removed in a future release.- Returns:
- whether rate-limited operations degrade gracefully instead of failing the build.
-
getCli
- Returns:
- the nested CLI extension.
-
cli
Configures the nested CLI extension using a Gradle action.- Parameters:
action- The configuration action.
-
cli
public void cli(groovy.lang.Closure<?> closure) Configures the nested CLI extension using a Groovy closure. Supports Gradle Groovy DSL usage:cli { ... }- Parameters:
closure- The configuration closure.
-
setUseCli
Deprecated.Replaced by the nestedcli { enabled = ... }block. This delegates toCliExtension.setEnabled(boolean)and will be removed in a future release.- Parameters:
useCli- whether to use the localghCLI for API calls.
-
isUseCli
Deprecated.Replaced by the nestedcli { enabled = ... }block. This delegates toCliExtension.isEnabled()and will be removed in a future release.- Returns:
- whether API calls are routed through the local
ghCLI.
-
setAccessToken
Deprecated.Replaced by the nestedauth { }block (tokenFile/sshKey). Still honoured as a fallback and will be removed in a future release.- Parameters:
accessToken- The path to the access token.
-
setAccessToken
Deprecated.Replaced by the nestedauth { }block (tokenFile/sshKey). Still honoured as a fallback and will be removed in a future release.- Parameters:
accessToken- The file containing the access token.
-
setAccessToken
Deprecated.Replaced by the nestedauth { token = ... }block. Still honoured as a fallback and will be removed in a future release.- Parameters:
accessToken- The access token string.
-
getAccessToken
Deprecated.PrefergetAuth(). Retained so the plugin can honour the legacy field.- Returns:
- The access token configured via the deprecated
accessTokenfield, or null.
-
getPublish
- Returns:
- The nested publish extension.
-
publish
Configures the nested publish extension using a Gradle action.- Parameters:
action- The configuration action.
-
publish
public void publish(groovy.lang.Closure<?> closure) Configures the nested publish extension using a Groovy closure. Supports Gradle Groovy DSL usage:publish { ... }- Parameters:
closure- The configuration closure.
-
getResources
- Returns:
- The nested resources extension.
-
resources
Configures the nested resources extension using a Gradle action.- Parameters:
action- The configuration action.
-
resources
public void resources(groovy.lang.Closure<?> closure) Configures the nested resources extension using a Groovy closure. Supports Gradle Groovy DSL usage:resources { ... }- Parameters:
closure- The configuration closure.
-
getAuth().