Fly.io Cleanup #3536
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Fly.io Cleanup | |
| on: | |
| schedule: | |
| # Run every hour | |
| - cron: "0 * * * *" | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Dry run (show what would be deleted without deleting)" | |
| required: false | |
| default: "false" | |
| type: boolean | |
| max_age: | |
| description: "Maximum age in hours before deletion (for apps with machines)" | |
| required: false | |
| default: "2" | |
| type: string | |
| jobs: | |
| cleanup: | |
| name: Cleanup Stale Test Apps | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup flyctl | |
| uses: superfly/flyctl-actions/setup-flyctl@master | |
| with: | |
| version: 0.4.60 | |
| - name: Run cleanup | |
| env: | |
| FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
| run: | | |
| ARGS="" | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| if [[ "${{ inputs.dry_run }}" == "true" ]]; then | |
| ARGS="$ARGS --dry-run" | |
| fi | |
| ARGS="$ARGS --max-age ${{ inputs.max_age }}" | |
| fi | |
| ./ci/fly/cleanup $ARGS |