Class GithubExtension

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

public class GithubExtension extends Object
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 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

      public AuthExtension getAuth()
      Returns:
      the nested auth extension.
    • auth

      public void auth(org.gradle.api.Action<? super AuthExtension> action)
      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

      public ResilienceExtension getResilience()
      Returns:
      the nested resilience extension.
    • resilience

      public void resilience(org.gradle.api.Action<? super ResilienceExtension> action)
      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 public void setSkipOnRateLimit(boolean skipOnRateLimit)
      Deprecated.
      Replaced by the nested resilience { skipOnRateLimit = ... } block. This delegates to ResilienceExtension.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 public boolean isSkipOnRateLimit()
      Deprecated.
      Replaced by the nested resilience { skipOnRateLimit = ... } block. This delegates to ResilienceExtension.isSkipOnRateLimit() and will be removed in a future release.
      Returns:
      whether rate-limited operations degrade gracefully instead of failing the build.
    • getCli

      public CliExtension getCli()
      Returns:
      the nested CLI extension.
    • cli

      public void cli(org.gradle.api.Action<? super CliExtension> action)
      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 public void setUseCli(boolean useCli)
      Deprecated.
      Replaced by the nested cli { enabled = ... } block. This delegates to CliExtension.setEnabled(boolean) and will be removed in a future release.
      Parameters:
      useCli - whether to use the local gh CLI for API calls.
    • isUseCli

      @Deprecated public boolean isUseCli()
      Deprecated.
      Replaced by the nested cli { enabled = ... } block. This delegates to CliExtension.isEnabled() and will be removed in a future release.
      Returns:
      whether API calls are routed through the local gh CLI.
    • setAccessToken

      @Deprecated public void setAccessToken(Path accessToken)
      Deprecated.
      Replaced by the nested auth { } 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 public void setAccessToken(File accessToken)
      Deprecated.
      Replaced by the nested auth { } 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 public void setAccessToken(String accessToken)
      Deprecated.
      Replaced by the nested auth { token = ... } block. Still honoured as a fallback and will be removed in a future release.
      Parameters:
      accessToken - The access token string.
    • getAccessToken

      @Deprecated public String getAccessToken()
      Deprecated.
      Prefer getAuth(). Retained so the plugin can honour the legacy field.
      Returns:
      The access token configured via the deprecated accessToken field, or null.
    • getPublish

      public PublishExtension getPublish()
      Returns:
      The nested publish extension.
    • publish

      public void publish(org.gradle.api.Action<? super PublishExtension> action)
      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

      public ResourcesExtension getResources()
      Returns:
      The nested resources extension.
    • resources

      public void resources(org.gradle.api.Action<? super ResourcesExtension> action)
      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.