From 9bd8b9689e7ae07ab1e8752e555ddf32cdfb28d0 Mon Sep 17 00:00:00 2001 From: David Riddervold Marconis Date: Thu, 28 Nov 2024 09:47:48 +0100 Subject: [PATCH] fix: Set env var if it differs from actual value --- action.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/action.yaml b/action.yaml index 14588de..bcc6e52 100644 --- a/action.yaml +++ b/action.yaml @@ -159,12 +159,13 @@ runs: local var_name="$1" local input_value="$2" local default_value="$3" - - if [ ! -z "$input_value" ] && [ "$input_value" != "$default_value" ]; then + local value="${!var_name}" + + if [ ! -z "$input_value" ] && [ "$input_value" != "$default_value" ] || [ "$value" != "$default_value" ]; then echo "$var_name=$input_value" >> $GITHUB_ENV fi } - + # Set environment variables, handling those with default values # cf. https://aquasecurity.github.io/trivy/latest/docs/configuration/#environment-variables set_env_var_if_provided "TRIVY_INPUT" "${{ inputs.input }}" ""