Class GithubExtension

java.lang.Object
io.github.intisy.gradle.github.plugin.extension.GithubExtension
All Implemented Interfaces:
GitHubConfig

public class GithubExtension extends Object implements GitHubConfig
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"
     }

     sources {
         git {
             url = "https://gitlab.com/me/lib.git"
             ref = "main"
         }
         jar {
             url = "https://nexus.internal/libs/foo-1.0.jar"
         }
     }
 }
 
  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.github.intisy.gradle.github.api.config.GitHubConfig

    GitHubConfig.Builder
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    auth(groovy.lang.Closure<?> closure)
    Configures the nested auth extension using a Groovy closure.
    void
    auth(org.gradle.api.Action<? super AuthSettings> action)
    Configures the nested auth extension using a Gradle action.
    void
    cli(groovy.lang.Closure<?> closure)
    Configures the nested CLI extension using a Groovy closure.
    void
    cli(org.gradle.api.Action<? super CliSettings> action)
    Configures the nested CLI extension using a Gradle action.
    Deprecated.
    Prefer getAuth().
     
     
     
     
     
     
    boolean
     
    boolean
    Deprecated.
    Replaced by the nested resilience { skipOnRateLimit = ... } block.
    boolean
    Deprecated.
    Replaced by the nested cli { enabled = ... } block.
    void
    publish(groovy.lang.Closure<?> closure)
    Configures the nested publish extension using a Groovy closure.
    void
    publish(org.gradle.api.Action<? super PublishExtension> action)
    Configures the nested publish extension using a Gradle action.
    void
    resilience(groovy.lang.Closure<?> closure)
    Configures the nested resilience extension using a Groovy closure.
    void
    resilience(org.gradle.api.Action<? super ResilienceSettings> action)
    Configures the nested resilience extension using a Gradle action.
    void
    resources(groovy.lang.Closure<?> closure)
    Configures the nested resources extension using a Groovy closure.
    void
    resources(org.gradle.api.Action<? super ResourceSettings> action)
    Configures the nested resources extension using a Gradle action.
    void
    setAccessToken(File accessToken)
    Deprecated.
    Replaced by the nested auth { } block (tokenFile / sshKey).
    void
    setAccessToken(String accessToken)
    Deprecated.
    Replaced by the nested auth { token = ... } block.
    void
    setAccessToken(Path accessToken)
    Deprecated.
    Replaced by the nested auth { } block (tokenFile / sshKey).
    void
    setDebug(boolean debug)
     
    void
    setSkipOnRateLimit(boolean skipOnRateLimit)
    Deprecated.
    Replaced by the nested resilience { skipOnRateLimit = ... } block.
    void
    setUseCli(boolean useCli)
    Deprecated.
    Replaced by the nested cli { enabled = ... } block.
    void
    sources(groovy.lang.Closure<?> closure)
    Configures the nested sources extension using a Groovy closure.
    void
    sources(org.gradle.api.Action<? super SourcesExtension> action)
    Configures the nested sources extension using a Gradle action.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 AuthSettings getAuth()
      Specified by:
      getAuth in interface GitHubConfig
      Returns:
      the nested auth extension.
    • auth

      public void auth(org.gradle.api.Action<? super AuthSettings> 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 ResilienceSettings getResilience()
      Specified by:
      getResilience in interface GitHubConfig
      Returns:
      the nested resilience extension.
    • resilience

      public void resilience(org.gradle.api.Action<? super ResilienceSettings> 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 ResilienceSettings.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 ResilienceSettings.isSkipOnRateLimit() and will be removed in a future release.
      Returns:
      whether rate-limited operations degrade gracefully instead of failing the build.
    • getCli

      public CliSettings getCli()
      Specified by:
      getCli in interface GitHubConfig
      Returns:
      the nested CLI extension.
    • cli

      public void cli(org.gradle.api.Action<? super CliSettings> 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 CliSettings.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 CliSettings.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.
      Specified by:
      getAccessToken in interface GitHubConfig
      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 ResourceSettings getResources()
      Returns:
      The nested resources extension.
    • resources

      public void resources(org.gradle.api.Action<? super ResourceSettings> 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.
    • getSources

      public SourcesExtension getSources()
      Returns:
      The nested sources extension.
    • sources

      public void sources(org.gradle.api.Action<? super SourcesExtension> action)
      Configures the nested sources extension using a Gradle action.
      Parameters:
      action - The configuration action.
    • sources

      public void sources(groovy.lang.Closure<?> closure)
      Configures the nested sources extension using a Groovy closure. Supports Gradle Groovy DSL usage: sources { git { } jar { } }
      Parameters:
      closure - The configuration closure.