Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions scripts/liveValidation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const utils = require('../test/util/utils'),
request = require('request-promise-native'),
zlib = require('zlib');

const repoUrl = utils.getRepoUrl(),
const repoUrl = utils.getSourceRepoUrl(),
validationService = "https://app.azure-devex-tools.com/api/validations",
branch = utils.getSourceBranch(),
processingDelay = 20,
Expand Down Expand Up @@ -75,7 +75,7 @@ async function runScript() {
let validationId = JSON.parse(response).validationId;

let validationResultUrl = `${validationService}/${validationId}`;
console.log(`Request done, results will in ${durationInSeconds} seconds...`);
console.log(`Request done, results will be available in ${durationInSeconds} seconds...`);

await timeout((durationInSeconds + processingDelay) * 1000);
let validationResult = JSON.parse(await request(validationResultUrl));
Expand Down
27 changes: 25 additions & 2 deletions test/util/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,20 @@ exports.getPullRequestNumber = function getPullRequestNumber() {
*/
exports.getRepoName = function getRepoName() {
let result = process.env['TRAVIS_REPO_SLUG'];
console.log(`@@@@@ process.env['TRAVIS_REPO_SLUG'] - ${process.env['TRAVIS_REPO_SLUG']}`);
console.log(`@@@@@ process.env['TRAVIS_REPO_SLUG'] - ${result}`);

return result;
};

/**
* Gets the source repo name for PR's. We are using the environment
* variable provided by travis-ci. It is called TRAVIS_PULL_REQUEST_SLUG. More info can be found here:
* https://docs.travis-ci.com/user/environment-variables/#Convenience-Variables
* @returns {string} repo name or 'undefined'.
*/
exports.getSourceRepoName = function getSourceRepoName() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: you may want to call the method getPrSourceRepoName, just to be more clear which source you're referring to.

let result = process.env['TRAVIS_PULL_REQUEST_SLUG'];
console.log(`@@@@@ process.env['TRAVIS_PULL_REQUEST_SLUG'] - ${result}`);

return result;
};
Expand All @@ -151,7 +164,17 @@ exports.getRepoName = function getRepoName() {
exports.getRepoUrl = function getRepoUrl() {
let repoName = exports.getRepoName();
return `https://github.com/${repoName}`;
}
};

// Retrieves the source Git Repository Url
/**
* Gets the repo URL from where the PR originated
* @returns {string} repo URL or 'undefined'
*/
exports.getSourceRepoUrl = function getSourceRepoUrl() {
let repoName = exports.getSourceRepoName();
return `https://github.com/${repoName}`;
};

exports.getTimeStamp = function getTimeStamp() {
// We pad each value so that sorted directory listings show the files in chronological order
Expand Down