Update action.yml to pass action environment variable
This commit is contained in:
11
action.yml
11
action.yml
@@ -367,17 +367,22 @@ runs:
|
|||||||
METRICS_REF=$(echo $METRICS_ACTION | sed -E 's/^.*metrics//g')
|
METRICS_REF=$(echo $METRICS_ACTION | sed -E 's/^.*metrics//g')
|
||||||
echo "Running on $METRICS_SOURCE/metrics@$METRICS_REF"
|
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
|
if [[ $METRICS_SOURCE == "lowlighter-test-forks" ]]; then
|
||||||
echo "Running docker image from GitHub registry"
|
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
|
# On forked actions, rebuild the docker image instead
|
||||||
else
|
else
|
||||||
echo "This is a forked version, rebuilding docker image from Dockerfile"
|
echo "This is a forked version, rebuilding docker image from Dockerfile"
|
||||||
cd $METRICS_ACTION_PATH
|
cd $METRICS_ACTION_PATH
|
||||||
docker build -t metrics:forked .
|
docker build -t metrics:forked .
|
||||||
docker run metrics:forked
|
METRICS_IMAGE=metrics:forked
|
||||||
fi
|
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
|
shell: bash
|
||||||
env:
|
env:
|
||||||
METRICS_ACTION: ${{ github.action }}
|
METRICS_ACTION: ${{ github.action }}
|
||||||
|
|||||||
Reference in New Issue
Block a user