NeonN
Neon3mo ago
1 reply
few-sapphire

delete branch github action issues

Hey y'all, I'm having a bit of a time trying to get the github action to destroy preview branches to work.

Some context: I set Neon through the Vercel integration, which handles the creation of Neon branches on PRs, but not the cleanup when closing them 🫢

So I'm working with neondatabase/delete-branch-action

- connected Github to Neon via your web interface
- this created NEON_API_KEY in my project's secrets (note: it did not create a NEON_PROJECT_ID secret.

The github action integration is quite simple:
name: Cleanup Neon Branch on PR Close

on:
  pull_request:
    types: [closed]

jobs:
  delete-neon-branch:
    runs-on: ubuntu-latest
    steps:
      - name: Delete Neon Branch
        uses: neondatabase/delete-branch-action@v3.1.3
        with:
          project_id: ${{ secrets.NEON_PROJECT_ID }}
          branch: preview/${{ github.event.pull_request.head.ref }}
          api_key: ${{ secrets.NEON_API_KEY }}


Running this yields the following error:
ERROR: not allowed to perform actions outside the project this key is scoped to; subject_project_id:"mute-base-72337215"

This makes sense, as the project id didn't get added to Github by Neon's web UI. Adding my project id manually yields an error that others have reported here:
ERROR: user has no access to projects


I'm unsure what user is being referred to here, and I don't think I've done anything out of the ordinary here. Anything to point me in the right direction is most welcome!
Was this page helpful?