Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
fix: warn when github user has not authed travis Closes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
boennemann authored and gr2m committed Aug 19, 2017
1 parent 3309aaf commit db355c9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,17 @@ module.exports = async function travisDeployOnce (env = process.env) {

const buildId = parseInt(env.TRAVIS_BUILD_ID, 10)
const buildApi = travis.builds(buildId)
const {build: {config, job_ids: jobs}} = await promisify(buildApi.get.bind(buildApi))()
try {
var {build: {config, job_ids: jobs}} = await promisify(buildApi.get.bind(buildApi))()
} catch (err) {
// https://github.com/semantic-release/travis-deploy-once/issues/3
// https://github.com/pwmckenna/node-travis-ci/issues/17
if (err.file === 'not found') {
throw new Error(`The GitHub user of the "GH_TOKEN" has not authenticated Travis CI yet.
Go to https://travis-ci.com/ and login with the GitHub user of this token.`)
}
throw err
}

const buildLeader = env.BUILD_LEADER_ID || (config.node_js
? electBuildLeader(config.node_js)
Expand Down

0 comments on commit db355c9

Please sign in to comment.