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

Commit

Permalink
Append auth token only when available in travis environment (#13272)
Browse files Browse the repository at this point in the history
* Append auth token only when available in travis environment

* Remove unused var
  • Loading branch information
swmitra authored and petetnt committed Apr 6, 2017
1 parent 9dec5b8 commit 24e79f7
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tasks/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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) {
Expand Down

0 comments on commit 24e79f7

Please sign in to comment.