Skip to content

Preview environment cleanup #4

Preview environment cleanup

Preview environment cleanup #4

name: Preview environment cleanup
on:
schedule:
- cron: 0 6 1 * * # at 06:00 on day-of-month 1, UTC
workflow_dispatch:
inputs:
reason:
description: The reason for dispatching it manually.
type: string
default: manual healthcheck
required: true
jobs:
delete:
name: Deleting
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Set up Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
cache-dependency-path: tools/package-lock.json
check-latest: true
- name: Install tools
run: ./Taskfile tools npm ci
- name: Remove deployments without an active alias
run: ./Taskfile @deployments clean
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
notify:
name: Notifying
needs: [ delete ]
runs-on: ubuntu-latest
if: failure() || success()
steps:
- name: Checkout the repository
uses: actions/checkout@v3
with: { fetch-depth: 0 }
- name: Send notification
uses: ./.github/actions/notify
continue-on-error: true
with:
emoji: 🧹
channel: ${{ secrets.SLACK_WEBHOOK }}
success: ${{ ! contains(needs.*.result, 'failure') }}