Skip to content

Commit

Permalink
SCAN-5687 : Add error handling around ref retrieval.
Browse files Browse the repository at this point in the history
  • Loading branch information
steviemul committed Sep 10, 2024
1 parent 33ea7c2 commit 765ed15
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,18 @@ const getRef = () => {

const thisBranchName = () => {

const ref = getRef();
try {
const ref = getRef();

const refParts = ref.split('/');
const refParts = ref.split('/');

return refParts[refParts.length-1];
return refParts[refParts.length-1];
}
catch (error) {
core.error(`Unable to get current branch name : ${error.message}`);
}

return DEFAULT_BRANCH_NAME;
};

const isDefaultBranch = () => {
Expand Down

0 comments on commit 765ed15

Please sign in to comment.