chore: github => octokit in release notes (#16332)

This commit is contained in:
Shelley Vohr 2019-01-08 16:20:54 -08:00 committed by GitHub
parent 349a3c20ae
commit 826063a2f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,15 +6,15 @@ const os = require('os')
const path = require('path') const path = require('path')
const { GitProcess } = require('dugite') const { GitProcess } = require('dugite')
const GitHub = require('github') const octokit = require('@octokit/rest')()
const semver = require('semver') const semver = require('semver')
const CACHE_DIR = path.resolve(__dirname, '.cache') const CACHE_DIR = path.resolve(__dirname, '.cache')
const NO_NOTES = 'No notes' const NO_NOTES = 'No notes'
const FOLLOW_REPOS = [ 'electron/electron', 'electron/libchromiumcontent', 'electron/node' ] const FOLLOW_REPOS = [ 'electron/electron', 'electron/libchromiumcontent', 'electron/node' ]
const github = new GitHub()
const gitDir = path.resolve(__dirname, '..', '..') const gitDir = path.resolve(__dirname, '..', '..')
github.authenticate({ type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN })
octokit.authenticate({ type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN })
const breakTypes = new Set(['breaking-change']) const breakTypes = new Set(['breaking-change'])
const docTypes = new Set(['doc', 'docs']) const docTypes = new Set(['doc', 'docs'])
@ -275,7 +275,7 @@ const getPullRequest = async (number, owner, repo) => {
const name = `${owner}-${repo}-pull-${number}` const name = `${owner}-${repo}-pull-${number}`
return checkCache(name, async () => { return checkCache(name, async () => {
try { try {
return await github.pullRequests.get({ number, owner, repo }) return await octokit.pulls.get({ number, owner, repo })
} catch (error) { } catch (error) {
// Silently eat 404s. // Silently eat 404s.
// We can get a bad pull number if someone manually lists // We can get a bad pull number if someone manually lists