From 56102cc2f404ab7cb7f6b32d19a2c8ffba04f8d4 Mon Sep 17 00:00:00 2001 From: linguist <22963968+lowlighter@users.noreply.github.com> Date: Thu, 31 Dec 2020 13:10:43 +0100 Subject: [PATCH] Update action.yml --- action.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/action.yml b/action.yml index 87f08845..2cb4712b 100644 --- a/action.yml +++ b/action.yml @@ -362,17 +362,19 @@ runs: steps: - run: | # Check if action is forked - IS_FORK=$(expr $(echo "${{ github.action }}" | sed -E 's/metrics.*?$//g') != "lowlighter") + IS_FORK=$(expr $(echo "$GITHUB_ACTION" | sed -E 's/metrics.*?$//g') != "lowlighter") # If forked, rebuild the docker image if [[ $IS_FORK ]]; then echo "Running on a forked action, rebuilding docker image from Dockerfile" - docker build -t ${{ github.action }}:local . - docker run ${{ github.action }}:local + docker build -t $GITHUB_ACTION:local . + docker run $GITHUB_ACTION:local # Else, use docker image from GitHub registry else - DOCKER_IMAGE=ghcr.io/lowlighter/metrics:$(echo ${{ github.action }} | sed -E 's/.*metrics//g') + DOCKER_IMAGE=ghcr.io/lowlighter/metrics:$(echo $GITHUB_ACTION | sed -E 's/.*metrics//g') echo "Running $DOCKER_IMAGE from GitHub registry" docker run $DOCKER_IMAGE fi - shell: bash \ No newline at end of file + shell: bash + env: + GITHUB_ACTION: ${{ github.action }} \ No newline at end of file