Enum Class CredentialProviders
java.lang.Object
java.lang.Enum<CredentialProviders>
io.github.duckasteroid.gradle.githubpackages.CredentialProviders
- All Implemented Interfaces:
Serializable,Comparable<CredentialProviders>,Constable
Provides standardised routes to get the authentication credentials for GitHub Packages.
Uses a three-tier fallback chain:
- Tier 1 (Gradle Properties): gpr.user / gpr.key from gradle.properties -
or, when a named
profileis given, gpr.<profile>.user / gpr.<profile>.key instead (deliberately not falling back to the unqualified gpr.user/gpr.key, so a mistyped profile name can't silently pick up the wrong identity) - Tier 2 (Read-Only): GH_PACKAGES_READ_USER / GH_PACKAGES_READ_TOKEN environment variables
- Tier 3 (GitHub Actions): GITHUB_ACTOR / GITHUB_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.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionorg.gradle.api.provider.Provider<String>apply(org.gradle.api.provider.ProviderFactory providers) Resolves credentials using no named profile - i.e.org.gradle.api.provider.Provider<String>apply(org.gradle.api.provider.ProviderFactory providers, org.gradle.api.provider.Provider<String> profile) Resolves credentials, preferring a namedprofile's gradle properties over the unqualified ones whenprofilehas a value.static CredentialProvidersReturns the enum constant of this class with the specified name.static CredentialProviders[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
USER
Resolves the GitHub username for authentication. The search path is:- Gradle property:
gpr.user, orgpr.<profile>.userwhen a profile is given - Environment variable:
GH_PACKAGES_READ_USER - Environment variable:
GITHUB_ACTOR
- Gradle property:
-
TOKEN
Resolves the GitHub token for authentication. The search path is:- Gradle property:
gpr.key, orgpr.<profile>.keywhen a profile is given - Environment variable:
GH_PACKAGES_READ_TOKEN - Environment variable:
GITHUB_TOKEN
- Gradle property:
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
apply
public org.gradle.api.provider.Provider<String> apply(org.gradle.api.provider.ProviderFactory providers) Resolves credentials using no named profile - i.e. today's default gpr.user/gpr.key chain. -
apply
public org.gradle.api.provider.Provider<String> apply(org.gradle.api.provider.ProviderFactory providers, org.gradle.api.provider.Provider<String> profile) Resolves credentials, preferring a namedprofile's gradle properties over the unqualified ones whenprofilehas a value. An absent or blank profile behaves the same asapply(ProviderFactory).
-