Class GithubExtension

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

public class GithubExtension extends Object
Extension for configuring GitHub integration.
 github {
     accessToken = "ghp_..."   // or a file/path containing the token
     debug = true
     skipOnRateLimit = true    // skip (don't fail) when a GitHub rate limit is hit
     useCli = true             // route API calls through the local "gh" CLI

     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.
    • setSkipOnRateLimit

      public void setSkipOnRateLimit(boolean skipOnRateLimit)
      Controls how a GitHub API rate limit is handled. When enabled, the plugin degrades gracefully instead of failing the build: a rate-limited dependency resolution falls back to the cached (possibly outdated) jar when one exists, and an update check keeps the currently declared version. Only when no cached copy exists is the dependency skipped. Defaults to false, which aborts the build on a rate limit.
      Parameters:
      skipOnRateLimit - whether to degrade gracefully (rather than fail) when the rate limit is hit.
    • isSkipOnRateLimit

      public boolean isSkipOnRateLimit()
      Returns:
      whether rate-limited operations are skipped instead of failing the build.
    • setUseCli

      public void setUseCli(boolean useCli)
      Controls whether GitHub REST calls are routed through the local gh CLI instead of direct HTTP. When enabled, the CLI's own authentication and higher rate limits are used; if gh is not installed the plugin falls back to HTTP. Defaults to false.
      Parameters:
      useCli - whether to use the local gh CLI for API calls.
    • isUseCli

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

      public void setAccessToken(Path accessToken)
      Parameters:
      accessToken - The path to the access token.
    • setAccessToken

      public void setAccessToken(File accessToken)
      Parameters:
      accessToken - The file containing the access token.
    • setAccessToken

      public void setAccessToken(String accessToken)
      Parameters:
      accessToken - The access token string.
    • getAccessToken

      public String getAccessToken()
      Returns:
      The access token.
    • 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.