Class CliExtension
java.lang.Object
io.github.intisy.gradle.github.extension.CliExtension
Extension for configuring the local GitHub CLI (
gh) transport.
github {
cli {
enabled = true // route GitHub REST calls through the "gh" CLI
fallback = true // fall back to HTTP when gh is unavailable or a call fails (default)
}
}
When enabled, API GET/POST requests are executed through gh api,
reusing the CLI's own authentication and higher (authenticated) rate limits. When
fallback is left at its default of true, the plugin transparently
reverts to direct HTTP if gh is not installed or a CLI invocation fails; setting it to
false instead surfaces the failure so the misconfiguration is not silently ignored.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanvoidsetEnabled(boolean enabled) Controls whether GitHub REST calls are routed through the localghCLI instead of direct HTTP.voidsetFallback(boolean fallback) Controls whether the plugin falls back to direct HTTP when theghCLI is enabled but cannot be used (not installed, or a CLI invocation fails).
-
Constructor Details
-
CliExtension
public CliExtension()
-
-
Method Details
-
setEnabled
public void setEnabled(boolean enabled) Controls whether GitHub REST calls are routed through the localghCLI instead of direct HTTP. Defaults tofalse.- Parameters:
enabled- whether to use theghCLI for API calls.
-
isEnabled
public boolean isEnabled()- Returns:
- whether API calls are routed through the local
ghCLI.
-
setFallback
public void setFallback(boolean fallback) Controls whether the plugin falls back to direct HTTP when theghCLI is enabled but cannot be used (not installed, or a CLI invocation fails). Defaults totrue. When set tofalse, such a situation raises an error instead of silently switching to HTTP.- Parameters:
fallback- whether to fall back to HTTP when the CLI is unavailable or fails.
-
isFallback
public boolean isFallback()- Returns:
- whether the plugin falls back to HTTP when the CLI cannot be used.
-