From 04b0bfbec567c73ff641db1936656e8551c29fc2 Mon Sep 17 00:00:00 2001 From: RedSparr0w Date: Tue, 26 Sep 2017 10:07:52 +1300 Subject: [PATCH 1/2] Fix Travis-CI github rate limiting Travis-CI Enviroment variable `github_token` will need to be set. --- lib/github-auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/github-auth.js b/lib/github-auth.js index 9efd5830861de..743ae399d82ee 100644 --- a/lib/github-auth.js +++ b/lib/github-auth.js @@ -11,7 +11,7 @@ try { var githubUserTokens = {data:[]}; var githubUserTokensFile = './private/github-user-tokens.json'; autosave(githubUserTokensFile, {data:[]}).then(function(f) { - githubUserTokens = f; + githubUserTokens = typeof process.env.TRAVIS != 'undefined' && process.env.TRAVIS ? process.env.github_token : f; for (var i = 0; i < githubUserTokens.data.length; i++) { addGithubToken(githubUserTokens.data[i]); } From af26fe9c0d04743aa90787e78d6222d225b059af Mon Sep 17 00:00:00 2001 From: RedSparr0w Date: Tue, 26 Sep 2017 14:10:01 +1300 Subject: [PATCH 2/2] addGithubToken if env variables exists unassigned githubUserTokens -> process.env.github_token --- lib/github-auth.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/github-auth.js b/lib/github-auth.js index 743ae399d82ee..401ca252d6bd5 100644 --- a/lib/github-auth.js +++ b/lib/github-auth.js @@ -11,7 +11,7 @@ try { var githubUserTokens = {data:[]}; var githubUserTokensFile = './private/github-user-tokens.json'; autosave(githubUserTokensFile, {data:[]}).then(function(f) { - githubUserTokens = typeof process.env.TRAVIS != 'undefined' && process.env.TRAVIS ? process.env.github_token : f; + githubUserTokens = f; for (var i = 0; i < githubUserTokens.data.length; i++) { addGithubToken(githubUserTokens.data[i]); } @@ -21,6 +21,11 @@ autosave(githubUserTokensFile, {data:[]}).then(function(f) { if (serverSecrets && serverSecrets.gh_token) { addGithubToken(serverSecrets.gh_token); } + // Travis-CI environment variable `github_token` + // Used only for tests + if (process.env.TRAVIS && process.env.github_token){ + addGithubToken(process.env.github_token); + } }).catch(function(e) { console.error('Could not create ' + githubUserTokensFile); }); function setRoutes(server) {