From 9598b87999643c3b09fd0bbeb7535e467958dd7c Mon Sep 17 00:00:00 2001 From: Stephen Mulrennan Date: Fri, 6 Sep 2024 16:23:02 +0100 Subject: [PATCH] SCAN-5687 : Fallback to high level ref. --- action.yml | 2 +- src/config.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index c2244aa..29d1fd9 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: 'Dockerfile' diff --git a/src/config.js b/src/config.js index ebad913..119a930 100644 --- a/src/config.js +++ b/src/config.js @@ -6,6 +6,8 @@ const WORKFLOW_DISPATCH = 'workflow_dispatch'; const PUSH_EVENT = 'push'; const DEFAULT_BRANCH_NAME = github.context.payload?.repository?.default_branch; +core.debug(JSON.stringify(github.context, null, 2)); + const getRef = () => { switch (github.context.eventName) { @@ -18,7 +20,7 @@ const getRef = () => { } default: { core.warning(`Received unexpected github event ${github.context.eventName}`); - return github.context.payload?.ref; + return github.context.ref || github.context.payload?.ref; } } }; @@ -84,7 +86,7 @@ const token = core.getInput("token"); core.debug(`Default branch name : ${DEFAULT_BRANCH_NAME}`); core.debug(`This branch name : ${thisBranchName()}`); core.debug(`Default branch resolved setting : ${defaultBranch}`) -core.debug(JSON.stringify(github.context, null, 2)); + module.exports = { apiUrl,