Skip to content

NP-177 (Have an indicator that we don't save transcript data) #106

NP-177 (Have an indicator that we don't save transcript data)

NP-177 (Have an indicator that we don't save transcript data) #106

name: Delete Neon Branch
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
on:
pull_request:
types:
- closed
paths-ignore:
- '*.md'
workflow_dispatch:
jobs:
delete-neon-branch:
permissions: write-all
runs-on: ubuntu-latest
steps:
- name: Search branch by name
id: get_branch_id
# list all branches and filter by name
run: |
branch_id=$(curl --silent \
"https://console.neon.tech/api/v2/projects/${{ secrets.NEON_PROJECT_ID }}/branches" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer ${{ secrets.NEON_API_KEY }}" \
| jq -r .branches \
| jq -c '.[] | select(.name | contains("'${{ github.event.pull_request.head.ref || github.head_ref }}'")) .id' \
| jq -r)
echo "branch_id=${branch_id}" >> $GITHUB_OUTPUT
- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v2
with:
project_id: ${{ secrets.NEON_PROJECT_ID }}
branch_id: ${{ steps.get_branch_id.outputs.branch_id }}
api_key: ${{ secrets.NEON_API_KEY }}