0.1.1 โ€ข Published 5 months ago

get-github-auth-token v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

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:

  1. process.env.GH_TOKEN
  2. 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.