NeonN
Neon2y ago
6 replies
living-lavender

Neon Github action for deleting a branch is flakey

I have the following github action script, and often times the delete-branch step fails

name: Neon Testing
on: push

jobs:
  neon-testing:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          lfs: true

      # Doppler setup
      - name: Setup Doppler
        uses: dopplerhq/secrets-fetch-action@v1.2.0
        id: doppler
        with:
          doppler-token: ${{ secrets.DOPPLER_CI_SERVICE_TOKEN }}
          inject-env-vars: true

      - name: Use Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '20'
          cache: 'yarn'
          registry-url: 'https://npm.pkg.github.com'

      - name: Install Dependencies
        run: yarn install --frozen-lockfile
        env:
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

      - name: Create Neon Feature Branch
        uses: neondatabase/create-branch-action@v5
        id: create-feat-branch
        with:
            project_id: xxxxxxx
            database: xxxxxxx
            username: xxxxxxx 
            branch_name: ${GITHUB_REF_NAME}
            api_key: ${{ secrets.NEON_API_KEY }}

      - name: Set Neon Branch ID
        run: echo "NEON_BRANCH_ID=${{ steps.create-feat-branch.outputs.branch_id }}" >> $GITHUB_ENV;

      - name: Set Neon Database URL for Testing
        run: echo "NEON_DATABASE_URL=${{ steps.create-feat-branch.outputs.db_url }}?sslmode=require" >> $GITHUB_ENV;

      - name: Integration Test Against New Neon Branch
        run: yarn test:integ
        env:
          IS_TEST: true

      - name: Delete Feature Branch
        if: always()
        uses: neondatabase/delete-branch-action@v3
        id: delete-feature-branch
        with:
          project_id: xxxxxxx
          branch: ${{ env.NEON_BRANCH_ID }}
          api_key: ${{ secrets.NEON_API_KEY }}
Screenshot_2024-08-05_at_12.42.19_PM.png
Was this page helpful?