0.1.1 โข Published 5 months ago
get-github-auth-token v0.1.1
Usage
npm i get-github-auth-token
import { getGitHubAuthToken } from "get-github-auth-token";
const auth = await getGitHubAuthToken("Hello, world! ๐");
if (auth.succeeded) {
console.log("Token:", auth.token);
} else {
console.error("Oh no:", auth.error);
}
getGitHubAuthToken
attempts to find a GitHub auth token from the following places, in order:
process.env.GH_TOKEN
- Executing
gh auth token
as a child process
๐ก Using this to create a new Octokit instance? See JoshuaKGoldberg/octokit-from-auth.
Contributors
๐ This package was templated with
create-typescript-app
.