diff --git a/action.yml b/action.yml index c2244aa..de552b7 100644 --- a/action.yml +++ b/action.yml @@ -71,4 +71,4 @@ inputs: default: ${{ github.token }} runs: using: 'docker' - image: 'docker://ghcr.io/contrast-security-oss/contrast-local-scan-action:sha-d2d24005fccf69c0f916bed5c97e720cc231b18b' + image: 'docker://ghcr.io/contrast-security-oss/contrast-local-scan-action:sha-9215789c436d9755e0f330b883793def98718018' diff --git a/src/config.js b/src/config.js index ebad913..9c46835 100644 --- a/src/config.js +++ b/src/config.js @@ -18,7 +18,7 @@ const getRef = () => { } default: { core.warning(`Received unexpected github event ${github.context.eventName}`); - return github.context.payload?.ref; + return github.context.payload?.ref || github.context.ref; } } }; @@ -26,10 +26,18 @@ const getRef = () => { const thisBranchName = () => { const ref = getRef(); + + try { + + const refParts = ref.split('/'); - const refParts = ref.split('/'); + return refParts[refParts.length-1]; + } + catch (error) { + core.error(`Unable to get current branch name from ref ${ref} : ${error.message}`); + } - return refParts[refParts.length-1]; + return DEFAULT_BRANCH_NAME }; const isDefaultBranch = () => {