-
Notifications
You must be signed in to change notification settings - Fork 2
30 lines (28 loc) · 1.02 KB
/
fly-cleanup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Cleans up orphaned test apps on Fly
# TODO: check app creation date - could destroy an app during a test run
# See <https://github.com/digidem/comapeo-core/issues/914>.
name: Fly Cleanup
on:
workflow_dispatch:
schedule:
- cron: '0 5 * * *' # Every day at 5am UTC
jobs:
cleanup:
name: Cleanup Orphaned Apps
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
run: |
fly apps list -q -o digidem | while IFS= read -r name; do
# Trim leading and trailing whitespace from $name
name=$(echo "$name" | xargs)
# Check if the name starts with 'comapeo-cloud-test-'
if [[ $name == comapeo-cloud-test-* ]]; then
# Call the fly destroy command with the name
fly apps destroy -y "$name"
fi
done