Skip to content

Upsert Migration

Upsert Migration #55

name: Upsert Migration
on:
pull_request_review:
types: [submitted]
# pull_request:
# branches:
# - main
# paths:
# - "**/*.up.sql"
jobs:
bytebase-upsert-migration:
runs-on: ubuntu-latest
# Runs only if PR is approved and target branch is main
if: github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'main'
env:
BYTEBASE_URL: "https://bytebase-ci.zeabur.app"
BYTEBASE_SERVICE_ACCOUNT: "[email protected]"
PROJECT: "example"
DATABASE: "instances/prod-instance/databases/example"
ISSUE_TITLE: "[${{ github.repository }}#${{ github.event.pull_request.number }}] ${{ github.event.pull_request.title }}"
DESCRIPTION: "Triggered by ${{ github.event.repository.html_url }}/pull/${{ github.event.pull_request.number }} ${{ github.event.pull_request.title }}"
name: Upsert Migration
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to Bytebase
id: login
uses: ./.github/actions/login
with:
url: ${{ env.BYTEBASE_URL }}
service-account: ${{ env.BYTEBASE_SERVICE_ACCOUNT }}
service-account-key: ${{ secrets.BYTEBASE_PASSWORD }}
- name: Upsert issue
id: upsert
uses: ./.github/actions/upsert-issue
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
pattern: "**/*.up.sql"
url: ${{ env.BYTEBASE_URL }}
token: ${{ steps.login.outputs.token }}
headers: '{"Accept-Encoding": "deflate, gzip"}'
project-id: ${{ env.PROJECT }}
database: ${{ env.DATABASE }}
title: ${{ env.ISSUE_TITLE }}
description: ${{ env.DESCRIPTION }}