Skip to content

Commit

Permalink
fix: bash script in happy-cleanup github action (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
katyho authored Nov 26, 2024
1 parent 6a1d02c commit 04fb669
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/actions/happy-cleanup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 04fb669

Please sign in to comment.