Skip to content

feat: 实现 Agent Query Sink #351

feat: 实现 Agent Query Sink

feat: 实现 Agent Query Sink #351

name: Preview database
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
permissions:
contents: read
concurrency:
group: preview-database-pr-${{ github.event.number }}
cancel-in-progress: false
env:
NEON_BRANCH_NAME: preview/core-py/pr-${{ github.event.number }}
NEON_PARENT_BRANCH: preview-base
NEON_PROJECT_ID: ${{ vars.NEON_PROJECT_ID }}
PDM_CHECK_UPDATE: "false"
jobs:
provision:
name: Provision isolated branch
if: >-
github.event.action != 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
- name: Set preview expiration
id: expiration
run: bash scripts/automation/preview_database.sh expiration
- name: Create or reuse data-free branch
id: neon
uses: neondatabase/create-branch-action@fb620d43d4c565abaf088b848a4e28e5c4ea4d9c # v6
with:
project_id: ${{ env.NEON_PROJECT_ID }}
branch_name: ${{ env.NEON_BRANCH_NAME }}
parent_branch: ${{ env.NEON_PARENT_BRANCH }}
role: neondb_owner
expires_at: ${{ steps.expiration.outputs.expires_at }}
api_key: ${{ secrets.NEON_API_KEY }}
- name: Report isolated branch identity
run: bash scripts/automation/preview_database.sh summarize
cleanup:
name: Delete preview branch
if: >-
github.event.action == 'closed' &&
github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout cleanup command
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5
with:
ref: ${{ github.workflow_sha }}
persist-credentials: false
- name: Delete deterministic Neon branch
env:
NEON_API_KEY: ${{ secrets.NEON_API_KEY }}
run: bash scripts/automation/preview_database.sh cleanup