@@ -34168,6 +34168,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
34168
34168
exports.generatePRComment = exports.createOrUpdateComment = exports.getActionCommentId = exports.getPullRequestNumber = void 0;
34169
34169
const core = __importStar(__nccwpck_require__(2186));
34170
34170
const github = __importStar(__nccwpck_require__(5438));
34171
+ const k6helper_1 = __nccwpck_require__(1034);
34171
34172
const { context } = github;
34172
34173
const { eventName, payload } = context;
34173
34174
const { repo, owner } = context.repo;
@@ -34276,10 +34277,10 @@ async function generatePRComment(testRunUrlsMap) {
34276
34277
core.debug('Generating PR comment');
34277
34278
let testRunUrls = '';
34278
34279
for (const [scriptPath, testRunUrl] of Object.entries(testRunUrlsMap)) {
34279
- testRunUrls += `🔗 [${scriptPath}](${testRunUrl})\n`;
34280
+ testRunUrls += `🔗 [${(0, k6helper_1.cleanScriptPath)( scriptPath) }](${testRunUrl})\n`;
34280
34281
}
34281
34282
let comment = `# Performance Test Results 🚀
34282
-
34283
+
34283
34284
Select a test run from below to view the test progress and results on Grafana Cloud K6:
34284
34285
34285
34286
${testRunUrls}
@@ -34289,20 +34290,21 @@ async function generatePRComment(testRunUrlsMap) {
34289
34290
pullRequestNumber = await getPullRequestNumber();
34290
34291
}
34291
34292
catch (error) {
34292
- core.error(`Error getting pull request number`);
34293
- core.error (error);
34293
+ core.debug(`Got following error in getting pull request number`);
34294
+ core.debug (error);
34294
34295
}
34295
34296
if (!pullRequestNumber) {
34296
- core.debug('Pull request number not found skipping comment creation');
34297
+ core.warning('Unable to get pull request number for the commit, skipping comment creation');
34297
34298
return;
34298
34299
}
34299
34300
try {
34300
34301
await createOrUpdateComment(pullRequestNumber, comment);
34301
34302
core.debug('Comment created successfully');
34302
34303
}
34303
34304
catch (error) {
34304
- core.error(`Error creating comment on pull request: ${pullRequestNumber}`);
34305
- core.error(error);
34305
+ core.warning('Error creating comment on pull request');
34306
+ core.debug(`Following error occurred in creating comment on pull request: ${pullRequestNumber}`);
34307
+ core.debug(error);
34306
34308
}
34307
34309
}
34308
34310
exports.generatePRComment = generatePRComment;
@@ -34387,9 +34389,17 @@ async function run() {
34387
34389
set: (target, key, value) => {
34388
34390
target[key] = value;
34389
34391
if (Object.keys(target).length === TOTAL_TEST_RUNS) {
34390
- if (isCloud && shouldCommentCloudTestRunUrlOnPR) {
34391
- // Generate PR comment with test run URLs
34392
- allPromises.push((0, githubHelper_1.generatePRComment)(target));
34392
+ // All test run cloud urls are available
34393
+ if (isCloud) {
34394
+ // Log test run URLs to the console
34395
+ console.log('🌐 Test run URLs:');
34396
+ for (const [script, url] of Object.entries(target)) {
34397
+ console.log(` ${(0, k6helper_1.cleanScriptPath)(script)}: ${url}`);
34398
+ }
34399
+ if (shouldCommentCloudTestRunUrlOnPR) {
34400
+ // Generate PR comment with test run URLs
34401
+ allPromises.push((0, githubHelper_1.generatePRComment)(target));
34402
+ }
34393
34403
}
34394
34404
}
34395
34405
return true;
@@ -34708,8 +34718,8 @@ exports.parseK6Output = parseK6Output;
34708
34718
"use strict";
34709
34719
34710
34720
Object.defineProperty(exports, "__esModule", ({ value: true }));
34711
- exports.validateTestPaths = void 0;
34712
- // Common helper functions used in the action
34721
+ exports.cleanScriptPath = exports. validateTestPaths = void 0;
34722
+ // Common helper functions used in the action
34713
34723
const child_process_1 = __nccwpck_require__(2081);
34714
34724
async function validateTestPaths(testPaths) {
34715
34725
/**
@@ -34745,6 +34755,20 @@ async function validateTestPaths(testPaths) {
34745
34755
return validK6TestPaths;
34746
34756
}
34747
34757
exports.validateTestPaths = validateTestPaths;
34758
+ function cleanScriptPath(scriptPath) {
34759
+ /**
34760
+ * Cleans the script path by removing the base directory prefix if it is present.
34761
+ *
34762
+ * @export
34763
+ * @param {string} scriptPath - The script path to clean
34764
+ * @return {string} - Cleaned script path
34765
+ *
34766
+ * */
34767
+ const baseDir = process.env['GITHUB_WORKSPACE'] || '';
34768
+ const cleanedScriptPath = scriptPath.replace(baseDir, '');
34769
+ return cleanedScriptPath.trim();
34770
+ }
34771
+ exports.cleanScriptPath = cleanScriptPath;
34748
34772
34749
34773
34750
34774
/***/ }),
0 commit comments