Enum Class CredentialProviders

java.lang.Object
java.lang.Enum<CredentialProviders>
io.github.duckasteroid.gradle.githubpackages.CredentialProviders
All Implemented Interfaces:
Serializable, Comparable<CredentialProviders>, Constable, Function<org.gradle.api.provider.ProviderFactory,org.gradle.api.provider.Provider<String>>

public enum CredentialProviders extends Enum<CredentialProviders> implements Function<org.gradle.api.provider.ProviderFactory,org.gradle.api.provider.Provider<String>>
Provides standardised routes to get the authentication credentials for GitHub Packages.

Uses a three-tier fallback chain:

  1. Tier 1 (Gradle Properties): gpr.user / gpr.key from gradle.properties
  2. Tier 2 (GitHub Actions): GITHUB_ACTOR / GITHUB_TOKEN environment variables
  3. Tier 3 (Read-Only): GH_PACKAGES_READ_USER / GH_PACKAGES_READ_TOKEN environment variables

The first available source in this chain is used. Once a value is found at any tier, lower tiers are not consulted.

  • Enum Constant Details

    • USER

      public static final CredentialProviders USER
      Resolves the GitHub username for authentication. The search path is:
      1. Gradle property: gpr.user
      2. Environment variable: GITHUB_ACTOR
      3. Environment variable: GH_PACKAGES_READ_USER
    • TOKEN

      public static final CredentialProviders TOKEN
      Resolves the GitHub token for authentication. The search path is:
      1. Gradle property: gpr.key
      2. Environment variable: GITHUB_TOKEN
      3. Environment variable: GH_PACKAGES_READ_TOKEN
  • Method Details

    • values

      public static CredentialProviders[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CredentialProviders valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null