Skip to content

Commit

Permalink
Optionally select the second element from array, fixes #214
Browse files Browse the repository at this point in the history
  • Loading branch information
mmatotan committed May 25, 2023
1 parent 967250e commit a5a0a45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,9 @@ const pkg = getPackageJson();
currentBranch = process.env.GITHUB_HEAD_REF;
isPullRequest = true;
} else {
currentBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF)[1];
let regexBranch = /refs\/[a-zA-Z]+\/(.*)/.exec(process.env.GITHUB_REF);
// If GITHUB_REF is null then do not set the currentBranch
currentBranch = regexBranch ? regexBranch[1] : undefined;
}
if (process.env['INPUT_TARGET-BRANCH']) {
// We want to override the branch that we are pulling / pushing to
Expand Down Expand Up @@ -229,7 +231,7 @@ const pkg = getPackageJson();
} catch (e) {
console.warn(
'git commit failed because you are using "actions/checkout@v2" or later; ' +
'but that doesnt matter because you dont need that git commit, thats only for "actions/checkout@v1"',
'but that doesnt matter because you dont need that git commit, thats only for "actions/checkout@v1"',
);
}

Expand Down

0 comments on commit a5a0a45

Please sign in to comment.