generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pass in token from kernel to authenticate octokit client
- Loading branch information
Showing
5 changed files
with
50 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Octokit } from "@octokit/rest"; | ||
import { parse } from "yargs"; | ||
|
||
let octokitInstance: Octokit | null = null; | ||
|
||
function getAuthenticationToken(): string { | ||
const argv = parse(process.argv.slice(2)); | ||
return argv.auth as string; | ||
} | ||
|
||
function getOctokitInstance(): Octokit { | ||
if (!octokitInstance) { | ||
const auth = getAuthenticationToken(); | ||
octokitInstance = new Octokit({ auth }); | ||
} | ||
return octokitInstance; | ||
} | ||
|
||
export { getOctokitInstance }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters