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

Append auth token only when available in travis environment #13272

Merged
merged 3 commits into from
Apr 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (oAuth_token.length) maybe?

options.path += "?access_token=" + process.env.BRACKETS_REPO_OAUTH_TOKEN;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this line be options.path += oAuth_token;

}

request = https.request(options, function (res) {
res.on("data", function (chunk) {
Expand Down