Class GitHubConfig.Builder

java.lang.Object
io.github.intisy.gradle.github.api.config.GitHubConfig.Builder
Enclosing interface:
GitHubConfig

public static final class GitHubConfig.Builder extends Object
Assembles an immutable GitHubConfig by composing AuthSettings, CliSettings and ResilienceSettings, the same settings types the Gradle DSL configures.
Implementation Note:
Each build() call snapshots this builder's current state into fresh copies of the three settings objects, and the built config hands out a fresh copy from every getter call in turn. So further calls to this builder never affect an already-built config, and mutating a settings object obtained from a built config never affects that config either.
  • Method Details

    • token

      public GitHubConfig.Builder token(String token)
      Parameters:
      token - a GitHub Personal Access Token, used for REST calls and HTTPS git operations.
      Returns:
      this builder.
    • tokenFile

      public GitHubConfig.Builder tokenFile(File tokenFile)
      Parameters:
      tokenFile - a file whose contents are a GitHub token, used when token(String) is not set.
      Returns:
      this builder.
    • sshKey

      public GitHubConfig.Builder sshKey(File sshKey)
      Parameters:
      sshKey - the SSH private key file used for git clone/pull over SSH.
      Returns:
      this builder.
    • cliEnabled

      public GitHubConfig.Builder cliEnabled(boolean enabled)
      Parameters:
      enabled - whether to route GitHub REST calls through the local gh CLI.
      Returns:
      this builder.
    • cliFallback

      public GitHubConfig.Builder cliFallback(boolean fallback)
      Parameters:
      fallback - whether to fall back to HTTP when gh is unavailable or fails.
      Returns:
      this builder.
    • skipOnRateLimit

      public GitHubConfig.Builder skipOnRateLimit(boolean skipOnRateLimit)
      Parameters:
      skipOnRateLimit - whether to degrade gracefully (rather than fail) when the rate limit is hit.
      Returns:
      this builder.
    • build

      public GitHubConfig build()
      Returns:
      an immutable GitHubConfig snapshot of this builder's current state.