Cleanup #605
This file contains 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: Cleanup | |
on: [delete] | |
env: | |
BASE_URL_PREVIEW: mailer-romainclement.vercel.app | |
jobs: | |
cleanup-preview-deployment: | |
name: Cleanup Preview Deployment | |
runs-on: ubuntu-latest | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | |
steps: | |
- name: Inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: Remove Vercel alias | |
run: | | |
VERCEL_ALIAS=${GITHUB_EVENT_REF_SLUG_URL}-${BASE_URL_PREVIEW} | |
vercel alias --token $VERCEL_TOKEN rm $VERCEL_ALIAS -y | |
- name: Delete GitHub environment | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GH_PERSONAL_TOKEN }} | |
script: | | |
github.rest.repos.deleteAnEnvironment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
environment_name: `preview/${process.env.GITHUB_EVENT_REF_SLUG_URL}`, | |
}) |