Skip to content

Commit 1162261

Browse files
clakechTimBeyer
authored andcommitted
feat: auth github request using env variable
1 parent b1a8679 commit 1162261

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ const matchGithub = <T>(url: string | undefined, prop: string) => {
3131
const getRangeFromPr = async () => {
3232
const {owner, repo, data: pull} = matchGithub(process.env['CIRCLE_PULL_REQUEST'], 'pull')
3333
const github = new Octokit()
34-
34+
if (process.env.GITHUB_TOKEN)
35+
github.authenticate({ type: 'token', token: process.env.GITHUB_TOKEN || '' })
36+
3537
console.log('📡 Looking up PR #%s...', pull)
3638
const {data: {base, head}} = await github.pullRequests.get(
3739
{owner, repo, number: +pull}

0 commit comments

Comments
 (0)