From fd07ad23cd71e35791fa929539ac577c5c4f0d57 Mon Sep 17 00:00:00 2001 From: Mahmoud Abdelwahab Date: Thu, 1 Feb 2024 20:25:20 +0200 Subject: [PATCH] Update workflows for preview deployment and branch deletion --- .github/workflows/delete-neon-branch.yml | 10 +++++++--- .github/workflows/deploy-preview.yml | 11 ++++------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/delete-neon-branch.yml b/.github/workflows/delete-neon-branch.yml index e663e9e..dcffb16 100644 --- a/.github/workflows/delete-neon-branch.yml +++ b/.github/workflows/delete-neon-branch.yml @@ -1,15 +1,19 @@ -name: Clean up Neon Branch +name: Clean up Preview Deployment on: pull_request: types: [closed] jobs: - delete-neon-branch: + delete-preview: runs-on: ubuntu-latest steps: + - name: Delete Fly app + id: deploy + uses: superfly/fly-pr-review-apps@1.2.0 + - name: Delete Neon Branch uses: neondatabase/delete-branch-action@v3.1.3 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 }} \ No newline at end of file + api_key: ${{ secrets.NEON_API_KEY }} diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index dfac09e..2f7c186 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -1,8 +1,6 @@ name: Preview Deployment -on: - pull_request: - types: [opened, reopened, synchronize, closed] - +on: [pull_request] + env: NEON_DATABASE_USERNAME: ${{ secrets.NEON_DATABASE_USERNAME }} # change this to your database username GH_TOKEN: ${{ secrets.GH_TOKEN }} # Required for commenting on pull requests for private repos @@ -27,7 +25,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: 18 - cache: 'pnpm' + cache: "pnpm" - name: Install dependencies run: pnpm install @@ -59,7 +57,6 @@ jobs: uses: superfly/fly-pr-review-apps@1.2.0 with: secrets: DATABASE_URL=${{ steps.create-branch.outputs.db_url }}?sslmode=require - - name: Comment on Pull Request uses: thollander/actions-comment-pull-request@v2 @@ -67,4 +64,4 @@ jobs: # GITHUB_TOKEN: ${{ env.GH_TOKEN }} # Required for private repos message: | Fly Preview URL :balloon: : ${{ steps.deploy.outputs.url }} - Neon branch :elephant: : https://console.neon.tech/app/projects/${{ secrets.NEON_PROJECT_ID }}/branches/${{ steps.create-branch.outputs.branch_id }} \ No newline at end of file + Neon branch :elephant: : https://console.neon.tech/app/projects/${{ secrets.NEON_PROJECT_ID }}/branches/${{ steps.create-branch.outputs.branch_id }}