Skip to content

Commit 4994fc6

Browse files
refactor: use new octokit auth constructor
1 parent fe44f7d commit 4994fc6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

main.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ const SimpleReporter = class {
1313
}
1414

1515
consola.setReporters(new SimpleReporter())
16-
const octokit = new Octokit()
16+
const octokit = new Octokit({
17+
auth: `token ${process.env.GITHUB_API_TOKEN}`
18+
})
1719

1820
const [owner, repo] = process.env.TRAVIS_REPO_SLUG.split('/')
1921
const ref = process.env.TRAVIS_PULL_REQUEST_SHA
2022

2123
const getSuccessfulDeployment = async () => {
22-
octokit.authenticate({ token: process.env.GITHUB_API_TOKEN, type: 'oauth' })
23-
2424
const { data: { statuses } } = await octokit.repos.getCombinedStatusForRef({ owner, ref, repo })
2525

2626
return statuses.find(({ context, state }) => /^netlify\/.*\/deploy-preview$/.test(context) && state === 'success')
@@ -32,7 +32,6 @@ const deployed = async () => Boolean(await getSuccessfulDeployment())
3232
await pWaitFor(deployed, { interval: 15000 })
3333

3434
const { target_url: targetUrl } = await getSuccessfulDeployment()
35-
// eslint-disable-next-line no-console
3635
consola.log(targetUrl)
3736
return targetUrl
3837
})()

0 commit comments

Comments
 (0)