We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 456dc24 commit 69bb5bcCopy full SHA for 69bb5bc
.github/workflows/awscleanup.yaml
@@ -41,10 +41,10 @@ jobs:
41
echo "Found instances: $running_instances"
42
echo "instances=$running_instances" >> $GITHUB_ENV
43
44
- # Find unused VPCs
+ # Find vpcs with names ci* running longer than 4 hours
45
vpcs=$(aws ec2 describe-vpcs \
46
--filters Name=tag:Name,Values=ci* \
47
- --query "Vpcs[?IsDefault==\`false\` && CreationTimestamp<=\`$(date -u -d '4 hours ago' +%Y-%m-%dT%H:%M:%SZ)\`].VpcId" \
+ --query "Vpcs[?Tags[?Key=='Name' && Value==`ci*`] && Tags[?Key=='CreationTime' && Value<=`$(date -u -d '4 hours ago' +%Y-%m-%dT%H:%M:%SZ)`]].VpcId" \
48
--output text | tr -d '\r' | tr '\n' ' ')
49
50
echo "Found VPCs: $vpcs"
0 commit comments