Class CliExtension

java.lang.Object
io.github.intisy.gradle.github.extension.CliExtension

public class CliExtension extends Object
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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    boolean
     
    void
    setEnabled(boolean enabled)
    Controls whether GitHub REST calls are routed through the local gh CLI instead of direct HTTP.
    void
    setFallback(boolean fallback)
    Controls whether the plugin falls back to direct HTTP when the gh CLI is enabled but cannot be used (not installed, or a CLI invocation fails).

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • CliExtension

      public CliExtension()
  • Method Details

    • setEnabled

      public void setEnabled(boolean enabled)
      Controls whether GitHub REST calls are routed through the local gh CLI instead of direct HTTP. Defaults to false.
      Parameters:
      enabled - whether to use the gh CLI for API calls.
    • isEnabled

      public boolean isEnabled()
      Returns:
      whether API calls are routed through the local gh CLI.
    • setFallback

      public void setFallback(boolean fallback)
      Controls whether the plugin falls back to direct HTTP when the gh CLI is enabled but cannot be used (not installed, or a CLI invocation fails). Defaults to true. When set to false, 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.