diff --git a/tasks/build.js b/tasks/build.js index 176b2d1bc81..6c051976309 100644 --- a/tasks/build.js +++ b/tasks/build.js @@ -123,11 +123,11 @@ module.exports = function (grunt) { // task: cla-check-pull grunt.registerTask("cla-check-pull", "Check if a given GitHub user has signed the CLA", function () { - var done = this.async(), - body = "", - options = {}, - travis = process.env.TRAVIS === "true", - pull = travis ? process.env.TRAVIS_PULL_REQUEST : (grunt.option("pull") || false), + var done = this.async(), + body = "", + options = {}, + travis = process.env.TRAVIS === "true", + pull = travis ? process.env.TRAVIS_PULL_REQUEST : (grunt.option("pull") || false), request; pull = parseInt(pull, 10); @@ -149,11 +149,17 @@ module.exports = function (grunt) { } options.host = "api.github.com"; - options.path = "/repos/adobe/brackets/issues/" + pull + "?access_token=" + process.env.BRACKETS_REPO_OAUTH_TOKEN; + options.path = "/repos/adobe/brackets/issues/" + pull; options.method = "GET"; options.headers = { "User-Agent" : "Node.js" }; + + // Append secret env var only when it's available + // Refer to https://docs.travis-ci.com/user/pull-requests/#Pull-Requests-and-Security-Restrictions + if (process.env.BRACKETS_REPO_OAUTH_TOKEN) { + options.path += "?access_token=" + process.env.BRACKETS_REPO_OAUTH_TOKEN; + } request = https.request(options, function (res) { res.on("data", function (chunk) {