build: remove deprecated octokit auth calls (#18205)

This commit is contained in:
Shelley Vohr 2019-05-07 18:48:40 -07:00 committed by GitHub
parent e63f527e76
commit 6770a8c64a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 23 deletions

View file

@ -1,6 +1,8 @@
if (!process.env.CI) require('dotenv-safe').load() if (!process.env.CI) require('dotenv-safe').load()
const octokit = require('@octokit/rest')() const octokit = require('@octokit/rest')({
auth: process.env.ELECTRON_GITHUB_TOKEN
})
if (process.argv.length < 3) { if (process.argv.length < 3) {
console.log('Usage: find-release version') console.log('Usage: find-release version')
@ -10,8 +12,6 @@ if (process.argv.length < 3) {
const version = process.argv[2] const version = process.argv[2]
async function findRelease () { async function findRelease () {
octokit.authenticate({ type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN })
const releases = await octokit.repos.listReleases({ const releases = await octokit.repos.listReleases({
owner: 'electron', owner: 'electron',
repo: version.indexOf('nightly') > 0 ? 'nightlies' : 'electron' repo: version.indexOf('nightly') > 0 ? 'nightlies' : 'electron'

View file

@ -5,7 +5,9 @@ const args = require('minimist')(process.argv.slice(2), {
boolean: ['automaticRelease', 'notesOnly', 'stable'] boolean: ['automaticRelease', 'notesOnly', 'stable']
}) })
const ciReleaseBuild = require('./ci-release-build') const ciReleaseBuild = require('./ci-release-build')
const octokit = require('@octokit/rest')() const octokit = require('@octokit/rest')({
auth: process.env.ELECTRON_GITHUB_TOKEN
})
const { execSync } = require('child_process') const { execSync } = require('child_process')
const { GitProcess } = require('dugite') const { GitProcess } = require('dugite')
@ -27,8 +29,6 @@ if (!bumpType && !args.notesOnly) {
} }
const gitDir = path.resolve(__dirname, '..') const gitDir = path.resolve(__dirname, '..')
octokit.authenticate({ type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN })
async function getNewVersion (dryRun) { async function getNewVersion (dryRun) {
if (!dryRun) { if (!dryRun) {
console.log(`Bumping for new "${bumpType}" version.`) console.log(`Bumping for new "${bumpType}" version.`)

View file

@ -12,16 +12,13 @@ const { execSync } = require('child_process')
const { GitProcess } = require('dugite') const { GitProcess } = require('dugite')
const { getCurrentBranch } = require('./lib/utils.js') const { getCurrentBranch } = require('./lib/utils.js')
const octokit = require('@octokit/rest')() const octokit = require('@octokit/rest')({
const path = require('path') auth: process.env.ELECTRON_GITHUB_TOKEN
const gitDir = path.resolve(__dirname, '..')
octokit.authenticate({
type: 'token',
token: process.env.ELECTRON_GITHUB_TOKEN
}) })
const path = require('path')
const gitDir = path.resolve(__dirname, '..')
function getLastBumpCommit (tag) { function getLastBumpCommit (tag) {
const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString() const data = execSync(`git log -n1 --grep "Bump ${tag}" --format='format:{"hash": "%H", "message": "%s"}'`).toString()
return JSON.parse(data) return JSON.parse(data)

View file

@ -6,7 +6,9 @@ const os = require('os')
const path = require('path') const path = require('path')
const { GitProcess } = require('dugite') const { GitProcess } = require('dugite')
const octokit = require('@octokit/rest')() const octokit = require('@octokit/rest')({
auth: process.env.ELECTRON_GITHUB_TOKEN
})
const semver = require('semver') const semver = require('semver')
const MAX_FAIL_COUNT = 3 const MAX_FAIL_COUNT = 3
@ -17,8 +19,6 @@ const NO_NOTES = 'No notes'
const FOLLOW_REPOS = [ 'electron/electron', 'electron/libchromiumcontent', 'electron/node' ] const FOLLOW_REPOS = [ 'electron/electron', 'electron/libchromiumcontent', 'electron/node' ]
const gitDir = path.resolve(__dirname, '..', '..') const gitDir = path.resolve(__dirname, '..', '..')
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'])
const featTypes = new Set(['feat', 'feature']) const featTypes = new Set(['feat', 'feature'])

View file

@ -24,10 +24,8 @@ const sumchecker = require('sumchecker')
const temp = require('temp').track() const temp = require('temp').track()
const { URL } = require('url') const { URL } = require('url')
const octokit = require('@octokit/rest')() const octokit = require('@octokit/rest')({
octokit.authenticate({ auth: process.env.ELECTRON_GITHUB_TOKEN
type: 'token',
token: process.env.ELECTRON_GITHUB_TOKEN
}) })
const targetRepo = pkgVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron' const targetRepo = pkgVersion.indexOf('nightly') > 0 ? 'nightlies' : 'electron'

View file

@ -2,8 +2,9 @@ if (!process.env.CI) require('dotenv-safe').load()
const fs = require('fs') const fs = require('fs')
const octokit = require('@octokit/rest')() const octokit = require('@octokit/rest')({
octokit.authenticate({ type: 'token', token: process.env.ELECTRON_GITHUB_TOKEN }) auth: process.env.ELECTRON_GITHUB_TOKEN
})
if (process.argv.length < 6) { if (process.argv.length < 6) {
console.log('Usage: upload-to-github filePath fileName releaseId') console.log('Usage: upload-to-github filePath fileName releaseId')