@@ -10,9 +10,6 @@ module.exports = {
10
10
ACCESS_KEY: 'access-key',
11
11
BUILD_NAME: 'build-name',
12
12
PROJECT_NAME: 'project-name',
13
- RERUN_ATTEMPT: 'rerun-attempt',
14
- REPOSITORY: 'repository',
15
- RUN_ID: 'run-id',
16
13
GITHUB_TOKEN: 'github-token',
17
14
GITHUB_APP: 'github-app',
18
15
},
@@ -21,7 +18,7 @@ module.exports = {
21
18
BROWSERSTACK_USERNAME: 'BROWSERSTACK_USERNAME',
22
19
BROWSERSTACK_ACCESS_KEY: 'BROWSERSTACK_ACCESS_KEY',
23
20
BROWSERSTACK_BUILD_NAME: 'BROWSERSTACK_BUILD_NAME',
24
- BROWSERSTACK_PROJECT_NAME: 'BROWSERSTACK_PROJECT_NAME'
21
+ BROWSERSTACK_PROJECT_NAME: 'BROWSERSTACK_PROJECT_NAME',
25
22
},
26
23
27
24
BROWSERSTACK_TEMPLATE: {
@@ -9335,7 +9332,7 @@ const axios = __nccwpck_require__(8757);
9335
9332
const github = __nccwpck_require__(5438);
9336
9333
const InputValidator = __nccwpck_require__(4881);
9337
9334
const constants = __nccwpck_require__(1468);
9338
- const { BROWSERSTACK_TEMPLATE} = __nccwpck_require__(1468);
9335
+ const { BROWSERSTACK_TEMPLATE } = __nccwpck_require__(1468);
9339
9336
9340
9337
const {
9341
9338
INPUT,
@@ -9366,11 +9363,11 @@ class ActionInput {
9366
9363
this.buildName = core.getInput(INPUT.BUILD_NAME);
9367
9364
this.projectName = core.getInput(INPUT.PROJECT_NAME);
9368
9365
9369
- this.rerunAttempt = core.getInput(INPUT.RERUN_ATTEMPT);
9370
- this.repository = core.getInput(INPUT.REPOSITORY);
9371
- this.runId = core.getInput(INPUT.RUN_ID);
9372
9366
this.githubToken = core.getInput(INPUT.GITHUB_TOKEN);
9373
9367
this.githubApp = core.getInput(INPUT.GITHUB_APP);
9368
+ this.rerunAttempt = process?.env?.GITHUB_RUN_ATTEMPT;
9369
+ this.runId = process?.env?.GITHUB_RUN_ID;
9370
+ this.repository = `${github?.context?.repo?.owner}/${github?.context?.repo?.repo}`;
9374
9371
} catch (e) {
9375
9372
throw Error(`Action input failed for reason: ${e.message}`);
9376
9373
}
@@ -9383,9 +9380,6 @@ class ActionInput {
9383
9380
this.username = InputValidator.updateUsername(this.username);
9384
9381
this.buildName = InputValidator.validateBuildName(this.buildName);
9385
9382
this.projectName = InputValidator.validateProjectName(this.projectName);
9386
- this.rerunAttempt = InputValidator.validateRerunAttempt(this.rerunAttempt);
9387
- this.runId = InputValidator.validateRunId(this.runId);
9388
- this.repository = InputValidator.validateRepository(this.repository);
9389
9383
this.githubToken = InputValidator.validateGithubToken(this.githubToken);
9390
9384
this.githubApp = InputValidator.validateGithubAppName(this.githubApp);
9391
9385
}
@@ -9410,11 +9404,6 @@ class ActionInput {
9410
9404
core.info(`${ENV_VARS.BROWSERSTACK_BUILD_NAME} environment variable set as: ${this.buildName}`);
9411
9405
core.info(`Use ${ENV_VARS.BROWSERSTACK_BUILD_NAME} environment variable for your build name capability in your tests\n`);
9412
9406
9413
- const runIdDirect = process.env.GITHUB_RUN_ID;
9414
- const rerunAttemptDirect = process.env.GITHUB_RUN_ATTEMPT;
9415
- const repositoryDirect = `${github.context.repo.owner}/${github.context.repo.repo}`;
9416
- core.info(`Direct values are - runIdDirect: ${runIdDirect}, rerunAttemptDirect: ${rerunAttemptDirect}, repositoryDirect: ${repositoryDirect}`);
9417
-
9418
9407
core.info(`Values of Bstack creds are: username - ${this.username}, accessKey - ${this.accessKey}`);
9419
9408
core.info(`Values of extractable vars are: rerunAttempt - ${this.rerunAttempt}, runId - ${this.runId}, repository - ${this.repository}`);
9420
9409
core.info(`Values of mandatory parms are: github_token - ${this.githubToken}, githubApp - ${this.githubApp}`);
@@ -9476,7 +9465,7 @@ class ActionInput {
9476
9465
const variables = bsApiResponse.data?.variables;
9477
9466
if (variables && typeof variables === 'object') {
9478
9467
// Iterate over all keys in variables and set them as environment variables
9479
- Object.keys(variables).forEach(key => {
9468
+ Object.keys(variables).forEach(( key) => {
9480
9469
core.exportVariable(key, variables[key]);
9481
9470
});
9482
9471
}
@@ -9611,44 +9600,6 @@ class InputValidator {
9611
9600
return inputProjectName;
9612
9601
}
9613
9602
9614
- /**
9615
- * Validates the rerun-attempt to ensure it is a valid number or 'none'.
9616
- * If the input is 'none' or not provided, it returns -1.
9617
- * @param {string} rerunAttempt Input for 'rerun-attempt'
9618
- * @returns {number} The validated rerun-attempt as a number, or -1 if 'none' or invalid
9619
- * @throws {Error} If the input is not a valid positive number or 'none'
9620
- */
9621
- static validateRerunAttempt(rerunAttempt) {
9622
- if (rerunAttempt && rerunAttempt.toLowerCase() !== 'none') {
9623
- const parsedAttempt = Number(rerunAttempt);
9624
- if (!Number.isNaN(parsedAttempt) && parsedAttempt >= 0) {
9625
- return parsedAttempt;
9626
- }
9627
- throw new Error("Invalid input for 'rerun-attempt'. Must be a positive number or 'none'.");
9628
- }
9629
-
9630
- return -1;
9631
- }
9632
-
9633
- /**
9634
- * Validates the run-id to ensure it is a valid number or 'none'.
9635
- * If the input is 'none' or not provided, it returns -1.
9636
- * @param {string} runId Input for 'run-id'
9637
- * @returns {number} The validated run-id as a number, or -1 if 'none' or invalid
9638
- * @throws {Error} If the input is not a valid positive number or 'none'
9639
- */
9640
- static validateRunId(runId) {
9641
- if (runId && runId.toLowerCase() !== 'none') {
9642
- const parsedRunId = Number(runId);
9643
- if (!Number.isNaN(parsedRunId) && parsedRunId >= 0) {
9644
- return parsedRunId;
9645
- }
9646
- throw new Error("Invalid input for 'run-id'. Must be a positive number or 'none'.");
9647
- }
9648
-
9649
- return -1;
9650
- }
9651
-
9652
9603
/**
9653
9604
* Validates the GitHub token input to ensure it is a valid non-empty string.
9654
9605
* If the input is 'none' or not provided, it returns 'none'.
@@ -9666,23 +9617,6 @@ class InputValidator {
9666
9617
return 'none';
9667
9618
}
9668
9619
9669
- /**
9670
- * Validates the repository input to ensure it is a valid non-empty string.
9671
- * If the input is 'none' or not provided, it returns 'none'.
9672
- * @param {string} repository Input for 'repository'
9673
- * @returns {string} Validated repository name, or 'none' if input is 'none' or invalid
9674
- * @throws {Error} If the input is not a valid non-empty string
9675
- */
9676
- static validateRepository(repository) {
9677
- if (repository && repository.toLowerCase() !== 'none') {
9678
- if (typeof repository === 'string' && repository.trim().length > 0) {
9679
- return repository;
9680
- }
9681
- throw new Error("Invalid input for 'repository'. Must be a valid string.");
9682
- }
9683
- return 'none';
9684
- }
9685
-
9686
9620
/**
9687
9621
* Validates the app name input to ensure it is a valid non-empty string.
9688
9622
* If the input is 'none' or not provided, it returns 'none'.
0 commit comments