diff --git a/.github/workflows/neon_workflow.yml b/.github/workflows/neon_workflow.yml new file mode 100644 index 0000000..88bd04d --- /dev/null +++ b/.github/workflows/neon_workflow.yml @@ -0,0 +1,28 @@ +name: Neon Database Branching + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + +jobs: + setup-neon-branch: + if: github.event.action != 'closed' + runs-on: ubuntu-latest + steps: + - name: Create Neon Branch + uses: neondatabase/create-branch-action@v5 + with: + project_id: ${{ vars.NEON_PROJECT_ID }} + branch_name: preview/pr-${{ github.event.number }} + api_key: ${{ secrets.NEON_API_KEY }} + + delete-neon-branch: + if: github.event.action == 'closed' + runs-on: ubuntu-latest + steps: + - name: Delete Neon Branch + uses: neondatabase/delete-branch-action@v3 + with: + project_id: ${{ vars.NEON_PROJECT_ID }} + branch: preview/pr-${{ github.event.number }} + api_key: ${{ secrets.NEON_API_KEY }} \ No newline at end of file