Skip to content
This repository has been archived by the owner on Aug 1, 2021. It is now read-only.

Commit

Permalink
use user config #37
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonLi8 committed Jan 22, 2020
1 parent b739742 commit b42432a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Labeler.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = ( () => {
const githubLabelSync = require( 'github-label-sync' ); // eslint-disable-line require-statement-match
const grunt = require( 'grunt' );
const path = require( 'path' );
const UserConfig = require( './UserConfig' );
const Util = require( './Util' );

// constants
Expand Down Expand Up @@ -61,7 +62,7 @@ module.exports = ( () => {
Util.assert( typeof allowAddedLabels === 'boolean', `invalid allowAddedLabels: ${ allowAddedLabels }` );

// Assert that the GITHUB_ACCESS_TOKEN node environment variable exists (see top of file for more documentation).
Util.assert( process.env.GITHUB_ACCESS_TOKEN, `Could not retrieve the GITHUB_ACCESS_TOKEN environment variable.
Util.assert( UserConfig.GITHUB_ACCESS_TOKEN, `Could not retrieve the GITHUB_ACCESS_TOKEN environment variable.
Labeler requires a GITHUB_ACCESS_TOKEN node environment variable for access to fetch and update labels.
The token must have permission to write to the repository. See https://github.com/settings/tokens
on how to create this token. The token GITHUB_ACCESS_TOKEN can be passed in the command line:\n
Expand Down Expand Up @@ -105,12 +106,12 @@ or defined in ~/.profile for permanent use (see https://help.ubuntu.com/communit
labels,
dryRun,
allowAddedLabels,
accessToken: process.env.GITHUB_ACCESS_TOKEN
accessToken: UserConfig.GITHUB_ACCESS_TOKEN
} );
}
catch( error ) {
// Inform user of bad credentials.
Util.throw( `${ error.message } with GITHUB_ACCESS_TOKEN: ${ process.env.GITHUB_ACCESS_TOKEN }` );
Util.throw( `${ error.message } with GITHUB_ACCESS_TOKEN: ${ UserConfig.GITHUB_ACCESS_TOKEN }` );
}

//----------------------------------------------------------------------------------------
Expand Down

0 comments on commit b42432a

Please sign in to comment.