Hot fix, Check all the way back to 2022 for degree plans #128
This file contains hidden or 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: 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 --fail-with-body \ | |
| "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@v3 | |
| with: | |
| project_id: ${{ secrets.NEON_PROJECT_ID }} | |
| branch_id: ${{ steps.get_branch_id.outputs.branch_id }} | |
| api_key: ${{ secrets.NEON_API_KEY }} |