Skip to content

Fly Cleanup

Fly Cleanup #2

Workflow file for this run

# 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