-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: clean preview environment on pr close
- Loading branch information
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Clean up Preview | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete-preview: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
|
||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
run_install: false | ||
|
||
- name: Delete Neon Branch | ||
uses: neondatabase/[email protected] | ||
with: | ||
project_id: ${{ secrets.NEON_PROJECT_ID }} | ||
branch: preview/pr-${{ github.event.number }}-${{ github.event.pull_request.head.ref }} | ||
api_key: ${{ secrets.NEON_API_KEY }} | ||
|
||
- name: Install Vercel CLI | ||
run: pnpm i -g vercel@latest | ||
|
||
- name: Delete Vercel Environment Information | ||
run: | | ||
vercel env rm DATABASE_URL preview ${{ steps.branch-name.outputs.current_branch }} --token=${{ secrets.VERCEL_TOKEN }} | ||
vercel env rm DIRECT_DATABASE_URL preview ${{ steps.branch-name.outputs.current_branch }} --token=${{ secrets.VERCEL_TOKEN }} | ||