Skip to content

Commit 169960b

Browse files
committed
adding limits in timeout
1 parent 19670e5 commit 169960b

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

browserstack-report-action/dist/index.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38164,6 +38164,19 @@ async function run() {
3816438164
const {
3816538165
username, accessKey, buildName, userTimeout,
3816638166
} = actionInput.getInputs();
38167+
38168+
let reportProcessor;
38169+
38170+
if (userTimeout < 20 || userTimeout > 600) {
38171+
const report = {
38172+
report: {
38173+
basicHtml: `<pre>Invalid user timeout value: ${userTimeout}. It should be between 20 and 600 seconds for Browserstack reports</pre>`,
38174+
},
38175+
};
38176+
reportProcessor = new ReportProcessor(report);
38177+
return;
38178+
}
38179+
3816738180
const authHeader = `Basic ${Buffer.from(`${username}:${accessKey}`).toString('base64')}`;
3816838181

3816938182
const timeManager = new TimeManager(userTimeout
@@ -38199,7 +38212,7 @@ async function run() {
3819938212
);
3820038213
}
3820138214

38202-
const reportProcessor = new ReportProcessor(reportData);
38215+
reportProcessor = new ReportProcessor(reportData);
3820338216
await reportProcessor.processReport();
3820438217
core.info('Report processing completed successfully');
3820538218
} catch (error) {

browserstack-report-action/src/main.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ async function run() {
1313
const {
1414
username, accessKey, buildName, userTimeout,
1515
} = actionInput.getInputs();
16+
17+
let reportProcessor;
18+
19+
if(userTimeout < 20 || userTimeout > 600) {
20+
const report = {
21+
report: {
22+
basicHtml: `<pre>Invalid user timeout value: ${userTimeout}. It should be between 20 and 600 seconds for Browserstack reports</pre>`,
23+
},
24+
}
25+
reportProcessor = new ReportProcessor(report);
26+
return ;
27+
}
28+
1629
const authHeader = `Basic ${Buffer.from(`${username}:${accessKey}`).toString('base64')}`;
1730

1831
const timeManager = new TimeManager(userTimeout
@@ -48,7 +61,7 @@ async function run() {
4861
);
4962
}
5063

51-
const reportProcessor = new ReportProcessor(reportData);
64+
reportProcessor = new ReportProcessor(reportData);
5265
await reportProcessor.processReport();
5366
core.info('Report processing completed successfully');
5467
} catch (error) {

0 commit comments

Comments
 (0)