From 8ab42de4dd42e2246bbb325fee65d36b58baa182 Mon Sep 17 00:00:00 2001 From: Sam Vendittelli Date: Thu, 23 Nov 2023 17:08:15 +0000 Subject: [PATCH] ci: delete vercel preview after PR closed --- .github/workflows/preview.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..d129f66 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,25 @@ +name: Preview Environment + +env: + VERCEL_ACCESS_TOKEN: ${{ secrets.VERCEL_ACCESS_TOKEN }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + +on: + pull_request: + types: [opened, synchronize, closed] + branches: + - main + +jobs: + deploy: + if: ${{ github.event.action == 'opened' || github.event.action == 'synchronize' }} + runs-on: ubuntu-latest + steps: + - uses: snaplet/vercel-action@v3.0.1 + delete: + if: ${{ github.event.action == 'closed' }} + runs-on: ubuntu-latest + steps: + - uses: snaplet/vercel-action@v3.0.1 + with: + delete: true