Class AuthExtension
java.lang.Object
io.github.intisy.gradle.github.extension.AuthExtension
Extension for configuring GitHub authentication credentials.
github {
auth {
token = "ghp_..." // a Personal Access Token
tokenFile = file("secrets/github.txt") // a file that contains a token
sshKey = file("~/.ssh/id_ed25519") // an SSH private key for git clone/pull
}
}
The token (used for REST calls and HTTPS git operations) is resolved with the precedence
token → tokenFile. The sshKey
is independent and drives git transport over SSH. All fields are optional; when none are set the
plugin operates unauthenticated (public repositories only).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetToken()voidSets the SSH private key file used for git clone/pull over SSH.voidSets the path to the SSH private key file used for git clone/pull over SSH.voidSets an explicit GitHub token (Personal Access Token) used for REST calls and HTTPS git operations.voidsetTokenFile(File tokenFile) Sets a file whose contents are a GitHub token.voidsetTokenFile(Path tokenFile) Sets a path to a file whose contents are a GitHub token.
-
Constructor Details
-
AuthExtension
public AuthExtension()
-
-
Method Details
-
setToken
Sets an explicit GitHub token (Personal Access Token) used for REST calls and HTTPS git operations.- Parameters:
token- the token value.
-
getToken
- Returns:
- the explicit token, or null if none was set.
-
setTokenFile
Sets a file whose contents are a GitHub token. Used whentokenis not set.- Parameters:
tokenFile- the file containing the token.
-
setTokenFile
Sets a path to a file whose contents are a GitHub token.- Parameters:
tokenFile- the path to the file containing the token.
-
getTokenFile
- Returns:
- the token file, or null if none was set.
-
setSshKey
Sets the SSH private key file used for git clone/pull over SSH.- Parameters:
sshKey- the private key file.
-
setSshKey
Sets the path to the SSH private key file used for git clone/pull over SSH.- Parameters:
sshKey- the path to the private key file.
-
getSshKey
- Returns:
- the SSH private key file, or null if none was set.
-