Skip to content

Migrate embedding logic to RAG sink domain with interval job and reranker #20

Migrate embedding logic to RAG sink domain with interval job and reranker

Migrate embedding logic to RAG sink domain with interval job and reranker #20

name: Branching database
on:
pull_request:
types:
- opened
- reopened
- synchronize
- closed
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
setup:
name: Setup
outputs:
current_branch: ${{ steps.branch_name.outputs.current_branch }}
base_ref_branch: ${{ steps.branch_name.outputs.base_ref_branch }}
runs-on: ubuntu-latest
steps:
- name: Get branch name
id: branch_name
uses: tj-actions/branch-names@v8
create_db_branch:
name: Create Database Branch
permissions:
contents: read
pull-requests: write
outputs:
# TODO further use (set to environment, run migrations or etc.)
db_url: ${{ steps.create_neon_branch.outputs.db_url }}
db_url_with_pooler: ${{ steps.create_neon_branch.outputs.db_url_with_pooler }}
needs: setup
if: |
github.event_name == 'pull_request' && (
github.event.action == 'synchronize'
|| github.event.action == 'opened'
|| github.event.action == 'reopened')
runs-on: ubuntu-latest
steps:
- name: Get branch expiration date as an env variable (2 weeks from now)
id: get_expiration_date
run: echo "EXPIRES_AT=$(date -u --date '+14 days' +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_ENV"
- name: Create Neon Branch
id: create_neon_branch
uses: neondatabase/create-branch-action@v6
with:
project_id: ${{ vars.NEON_PROJECT_ID }}
branch_name: ${{ needs.setup.outputs.current_branch }}
branch_type: "schema-only"
parent_branch: ${{ needs.setup.outputs.base_ref_branch || 'develop' }}
api_key: ${{ secrets.NEON_API_KEY }}
expires_at: ${{ env.EXPIRES_AT }}
- name: Post Schema Diff Comment to PR
uses: neondatabase/schema-diff-action@v1
with:
project_id: ${{ vars.NEON_PROJECT_ID }}
compare_branch: ${{ needs.setup.outputs.current_branch }}
base_branch: ${{ needs.setup.outputs.base_ref_branch || 'develop' }}
api_key: ${{ secrets.NEON_API_KEY }}
delete_db_branch:
name: Delete Database Branch
needs: setup
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Delete Neon Branch
uses: neondatabase/delete-branch-action@v3
with:
project_id: ${{ vars.NEON_PROJECT_ID }}
branch: pr/${{ needs.setup.outputs.current_branch }}
api_key: ${{ secrets.NEON_API_KEY }}