From 04fb669a704eea859935253e5c2fb72b7cdbdd61 Mon Sep 17 00:00:00 2001 From: Katy Ho Date: Tue, 26 Nov 2024 11:51:45 -0800 Subject: [PATCH] fix: bash script in happy-cleanup github action (#329) --- .github/actions/happy-cleanup/action.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/actions/happy-cleanup/action.yml b/.github/actions/happy-cleanup/action.yml index 20a182c2..abdbdc5a 100644 --- a/.github/actions/happy-cleanup/action.yml +++ b/.github/actions/happy-cleanup/action.yml @@ -58,20 +58,20 @@ runs: set -o pipefail date=`date +%Y-%m-%d'T'%H:%M'Z' -d "$TIME ago"` - list="happy list --aws-profile "" --output json --env $ENV" + list=("happy" "list" "--aws-profile" "" "--output" "json" "--env" "$ENV") force="" if [[ ${ALL} ]]; then - list="happy list --aws-profile "" --all --output json --env $ENV" + list=("happy" "list" "--aws-profile" "" "--output" "json" "--env" "$ENV") force="--force" fi if [[ ! -z ${EXCLUDE} ]]; then - for i in $($(echo $list) | jq -r --arg date "$date" --arg exclude "$EXCLUDE" '.[] | select(.last_updated < $date) | select(any(.stack; contains($exclude))|not) | .stack'); do + for i in $("${list[@]}" | jq -r --arg date "$date" --arg exclude "$EXCLUDE" '.[] | select(.last_updated < $date) | select(any(.stack; contains($exclude))|not) | .stack'); do echo "Deleting stack: $i" happy delete --aws-profile "" $i --env $ENV "$force" done exit fi - for i in $($(echo $list) | jq -r --arg date "$date" '.[] | select(.last_updated < $date) | .stack'); do + for i in $("${list[@]}" | jq -r --arg date "$date" '.[] | select(.last_updated < $date) | .stack'); do echo "Deleting stack: $i" happy delete --aws-profile "" $i --env $ENV "$force" done