Skip to content

Commit

Permalink
Merge pull request #82 from loopmediagroup/dev
Browse files Browse the repository at this point in the history
[Gally]: master <- dev
  • Loading branch information
simlu committed Jul 27, 2018
2 parents cc2921d + 3651fbe commit 43ef2a5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/configs/default.json
Expand Up @@ -25,7 +25,7 @@
"feat/*": {
"upstream": "dev"
},
"greenkeeper/*": {
"dependabot/*": {
"upstream": "dev"
}
},
Expand All @@ -42,8 +42,7 @@
"contexts": [
"continuous-integration/circle-ci",
"continuous-integration/travis-ci",
"coverage/coveralls",
"greenkeeper/verify"
"coverage/coveralls"
]
},
"enforce_admins": true,
Expand Down
3 changes: 2 additions & 1 deletion src/gally.js
Expand Up @@ -5,6 +5,7 @@ const set = require("lodash.set");
const mergeWith = require("lodash.mergewith");
const inquirer = require('inquirer');
const json = require("./util/json");
const ci = require("./util/ci");

module.exports.load = async (configDir, cwd) => {
if (!fs.existsSync(configDir)) {
Expand All @@ -17,7 +18,7 @@ module.exports.load = async (configDir, cwd) => {
const globalConfig = json.loadOrDefault(globalConfigFile);
const credentials = json.loadOrDefault(credentialsFile);

if (get(credentials, "github.token", process.env.GH_TOKEN) === undefined) {
if (get(credentials, "github.token", process.env.GH_TOKEN) === undefined && !ci.isCI()) {
const token = (await inquirer.prompt([{
type: 'password',
message: 'Enter github personal access token',
Expand Down
6 changes: 6 additions & 0 deletions src/util/ci.js
@@ -0,0 +1,6 @@
module.exports.isCI = () => [
"CI",
"CONTINUOUS_INTEGRATION",
"BUILD_NUMBER",
"TRAVIS"
].some(v => process.env[v] !== undefined);
5 changes: 5 additions & 0 deletions test/gally.spec.js
Expand Up @@ -3,8 +3,11 @@ const path = require('path');
const expect = require('chai').expect;
const inquirer = require('inquirer');
const tmp = require('tmp');
const ci = require('./../src/util/ci');
const gally = require('./../src/gally');

const isCiOriginal = ci.isCI;

tmp.setGracefulCleanup();

describe("Testing Gally", () => {
Expand All @@ -13,6 +16,7 @@ describe("Testing Gally", () => {
let promptCount = 0;

before(() => {
ci.isCI = () => false;
inquirerPrompt = inquirer.prompt;
inquirer.prompt = () => {
promptCount += 1;
Expand All @@ -25,6 +29,7 @@ describe("Testing Gally", () => {
});

after(() => {
ci.isCI = isCiOriginal;
inquirer.prompt = inquirerPrompt;
process.env.GH_TOKEN = ghToken;
});
Expand Down
8 changes: 8 additions & 0 deletions test/util/ci.spec.js
@@ -0,0 +1,8 @@
const expect = require('chai').expect;
const ci = require('./../../src/util/ci');

describe("Testing ci.js", () => {
it("Testing isCi", () => {
expect(typeof ci.isCI()).to.equal("boolean");
});
});

0 comments on commit 43ef2a5

Please sign in to comment.