Update action.yml to pass action environment variable

This commit is contained in:
linguist
2020-12-31 14:29:01 +01:00
parent 32a90c5375
commit 4bf3f8b28f

View File

@@ -367,17 +367,22 @@ runs:
METRICS_REF=$(echo $METRICS_ACTION | sed -E 's/^.*metrics//g')
echo "Running on $METRICS_SOURCE/metrics@$METRICS_REF"
# If using official action, run docker image from GitHub registry
# If using official action, use docker image from GitHub registry
if [[ $METRICS_SOURCE == "lowlighter-test-forks" ]]; then
echo "Running docker image from GitHub registry"
docker run ghcr.io/lowlighter/metrics:$METRICS_REF
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_REF
# On forked actions, rebuild the docker image instead
else
echo "This is a forked version, rebuilding docker image from Dockerfile"
cd $METRICS_ACTION_PATH
docker build -t metrics:forked .
docker run metrics:forked
METRICS_IMAGE=metrics:forked
fi
# Run docker image with current environment
echo "Using $METRICS_IMAGE"
env | grep -E '^(INPUT|GITHUB|RUNNER|ACTIONS|HOME|CI)' > .env
docker run --env-file .env $METRICS_IMAGE
shell: bash
env:
METRICS_ACTION: ${{ github.action }}