Skip to content

Commit

Permalink
aDDING TOKEN INPUT PARAM
Browse files Browse the repository at this point in the history
  • Loading branch information
darpanLalwani committed Sep 24, 2024
1 parent dad36c3 commit 7f73d9c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions setup-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
project-name:
description: 'Project name for the tests'
required: false
github-token:
description: 'BrowserStack Github Token'
required: false
github-app:
description: 'BrowserStack Github App'
required: false
Expand Down
1 change: 1 addition & 0 deletions setup-env/config/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
BUILD_NAME: 'build-name',
PROJECT_NAME: 'project-name',
GITHUB_APP: 'github-app',
GITHUB_TOKEN: 'github-token',
},

ENV_VARS: {
Expand Down
6 changes: 3 additions & 3 deletions setup-env/src/actionInput/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class ActionInput {
this.rerunAttempt = process?.env?.GITHUB_RUN_ATTEMPT;
this.runId = process?.env?.GITHUB_RUN_ID;
this.repository = process?.env?.GITHUB_REPOSITORY;
this.githubToken = core.getInput(INPUT.GITHUB_TOKEN);
} catch (e) {
throw Error(`Action input failed for reason: ${e.message}`);
}
Expand Down Expand Up @@ -95,12 +96,11 @@ class ActionInput {

async identifyRunFromBStack() {
try {
const githubToken = process.env.GITHUB_TOKEN;
const runDetailsUrl = `https://api.github.com/repos/${this.repository}/actions/runs/${this.runId}`;
core.info(`Github token is - ${githubToken} and url is - ${runDetailsUrl}`);
core.info(`Github token is - ${this.githubToken} and url is - ${runDetailsUrl}`);
const runDetailsResponse = await axios.get(runDetailsUrl, {
headers: {
Authorization: `token ${githubToken}`,
Authorization: `token ${this.githubToken}`,
Accept: 'application/vnd.github.v3+json',
},
});
Expand Down

0 comments on commit 7f73d9c

Please sign in to comment.