public class GithubExtension extends java.lang.Object implements GitHubConfig
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"
}
sources {
git {
url = "https://gitlab.com/me/lib.git"
ref = "main"
}
jar {
url = "https://nexus.internal/libs/foo-1.0.jar"
}
}
}
GitHubConfig.Builder| Constructor and Description |
|---|
GithubExtension() |
| Modifier and Type | Method and Description |
|---|---|
void |
auth(org.gradle.api.Action<? super AuthSettings> action)
Configures the nested auth extension using a Gradle action.
|
void |
auth(groovy.lang.Closure<?> closure)
Configures the nested auth extension using a Groovy closure.
|
void |
cli(org.gradle.api.Action<? super CliSettings> action)
Configures the nested CLI extension using a Gradle action.
|
void |
cli(groovy.lang.Closure<?> closure)
Configures the nested CLI extension using a Groovy closure.
|
java.lang.String |
getAccessToken()
Deprecated.
Prefer
getAuth(). Retained so the plugin can honour the legacy field. |
AuthSettings |
getAuth() |
CliSettings |
getCli() |
PackagesExtension |
getPackages() |
PublishExtension |
getPublish() |
ResilienceSettings |
getResilience() |
ResourceSettings |
getResources() |
SourcesExtension |
getSources() |
boolean |
isDebug() |
boolean |
isSkipOnRateLimit()
Deprecated.
Replaced by the nested
resilience { skipOnRateLimit = ... } block. This
delegates to ResilienceSettings.isSkipOnRateLimit() and will be removed
in a future release. |
boolean |
isUseCli()
Deprecated.
Replaced by the nested
cli { enabled = ... } block. This delegates to
CliSettings.isEnabled() and will be removed in a future release. |
void |
packages(org.gradle.api.Action<? super PackagesExtension> action)
Configures the nested packages extension using a Gradle action.
|
void |
packages(groovy.lang.Closure<?> closure)
Configures the nested packages extension using a Groovy closure.
|
void |
publish(org.gradle.api.Action<? super PublishExtension> action)
Configures the nested publish extension using a Gradle action.
|
void |
publish(groovy.lang.Closure<?> closure)
Configures the nested publish extension using a Groovy closure.
|
void |
resilience(org.gradle.api.Action<? super ResilienceSettings> action)
Configures the nested resilience extension using a Gradle action.
|
void |
resilience(groovy.lang.Closure<?> closure)
Configures the nested resilience extension using a Groovy closure.
|
void |
resources(org.gradle.api.Action<? super ResourceSettings> action)
Configures the nested resources extension using a Gradle action.
|
void |
resources(groovy.lang.Closure<?> closure)
Configures the nested resources extension using a Groovy closure.
|
void |
setAccessToken(java.io.File accessToken)
Deprecated.
Replaced by the nested
auth { } block (tokenFile / sshKey).
Still honoured as a fallback and will be removed in a future release. |
void |
setAccessToken(java.nio.file.Path accessToken)
Deprecated.
Replaced by the nested
auth { } block (tokenFile / sshKey).
Still honoured as a fallback and will be removed in a future release. |
void |
setAccessToken(java.lang.String accessToken)
Deprecated.
Replaced by the nested
auth { token = ... } block. Still honoured as a
fallback and will be removed in a future release. |
void |
setDebug(boolean debug) |
void |
setSkipOnRateLimit(boolean skipOnRateLimit)
Deprecated.
Replaced by the nested
resilience { skipOnRateLimit = ... } block. This
delegates to ResilienceSettings.setSkipOnRateLimit(boolean) and will be
removed in a future release. |
void |
setUseCli(boolean useCli)
Deprecated.
Replaced by the nested
cli { enabled = ... } block. This delegates to
CliSettings.setEnabled(boolean) and will be removed in a future release. |
void |
sources(org.gradle.api.Action<? super SourcesExtension> action)
Configures the nested sources extension using a Gradle action.
|
void |
sources(groovy.lang.Closure<?> closure)
Configures the nested sources extension using a Groovy closure.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbuilderpublic void setDebug(boolean debug)
debug - Whether to enable debug logging.public boolean isDebug()
public AuthSettings getAuth()
getAuth in interface GitHubConfigpublic void auth(org.gradle.api.Action<? super AuthSettings> action)
action - The configuration action.public void auth(groovy.lang.Closure<?> closure)
auth { ... }closure - The configuration closure.public ResilienceSettings getResilience()
getResilience in interface GitHubConfigpublic void resilience(org.gradle.api.Action<? super ResilienceSettings> action)
action - The configuration action.public void resilience(groovy.lang.Closure<?> closure)
resilience { ... }closure - The configuration closure.@Deprecated public void setSkipOnRateLimit(boolean skipOnRateLimit)
resilience { skipOnRateLimit = ... } block. This
delegates to ResilienceSettings.setSkipOnRateLimit(boolean) and will be
removed in a future release.skipOnRateLimit - whether to degrade gracefully (rather than fail) when the rate limit is hit.@Deprecated public boolean isSkipOnRateLimit()
resilience { skipOnRateLimit = ... } block. This
delegates to ResilienceSettings.isSkipOnRateLimit() and will be removed
in a future release.public CliSettings getCli()
getCli in interface GitHubConfigpublic void cli(org.gradle.api.Action<? super CliSettings> action)
action - The configuration action.public void cli(groovy.lang.Closure<?> closure)
cli { ... }closure - The configuration closure.@Deprecated public void setUseCli(boolean useCli)
cli { enabled = ... } block. This delegates to
CliSettings.setEnabled(boolean) and will be removed in a future release.useCli - whether to use the local gh CLI for API calls.@Deprecated public boolean isUseCli()
cli { enabled = ... } block. This delegates to
CliSettings.isEnabled() and will be removed in a future release.gh CLI.@Deprecated public void setAccessToken(java.nio.file.Path accessToken)
auth { } block (tokenFile / sshKey).
Still honoured as a fallback and will be removed in a future release.accessToken - The path to the access token.@Deprecated public void setAccessToken(java.io.File accessToken)
auth { } block (tokenFile / sshKey).
Still honoured as a fallback and will be removed in a future release.accessToken - The file containing the access token.@Deprecated public void setAccessToken(java.lang.String accessToken)
auth { token = ... } block. Still honoured as a
fallback and will be removed in a future release.accessToken - The access token string.@Deprecated public java.lang.String getAccessToken()
getAuth(). Retained so the plugin can honour the legacy field.getAccessToken in interface GitHubConfigaccessToken field, or null.public PublishExtension getPublish()
public void publish(org.gradle.api.Action<? super PublishExtension> action)
action - The configuration action.public void publish(groovy.lang.Closure<?> closure)
publish { ... }closure - The configuration closure.public ResourceSettings getResources()
public void resources(org.gradle.api.Action<? super ResourceSettings> action)
action - The configuration action.public void resources(groovy.lang.Closure<?> closure)
resources { ... }closure - The configuration closure.public SourcesExtension getSources()
public void sources(org.gradle.api.Action<? super SourcesExtension> action)
action - The configuration action.public void sources(groovy.lang.Closure<?> closure)
sources { git { } jar { } } closure - The configuration closure.public PackagesExtension getPackages()
public void packages(org.gradle.api.Action<? super PackagesExtension> action)
action - The configuration action.public void packages(groovy.lang.Closure<?> closure)
packages { from "owner/repo" } closure - The configuration closure.