From dae1d26624d2cc3d5d0df41b5180760406f0dbe0 Mon Sep 17 00:00:00 2001 From: lingying Date: Wed, 8 Jul 2026 22:48:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20=E6=81=A2=E5=A4=8D=E5=AE=8C=E6=95=B4?= =?UTF-8?q?CI=E9=85=8D=E7=BD=AE=20+=20=E9=AA=8C=E8=AF=81SQLite=E8=B6=85?= =?UTF-8?q?=E6=97=B6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-cd.yml | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index 7b61bcd53..bb0e32e2b 100755 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -129,11 +129,34 @@ jobs: grep -q "Running upgrade" /tmp/alembic-upgrade.sql python3 scripts/check_schema_metadata.py + - name: Prepare git for migration diff + shell: sh + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + set -eu + if command -v git >/dev/null 2>&1; then + git init -q + git config user.email "ci@localhost" + git config user.name "CI" + git add . + git commit -q -m "current" + REPO_URL="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" + git remote add origin "$REPO_URL" + git fetch origin main --depth=1 -q 2>/dev/null || echo "WARN: cannot fetch main, will check all migrations" + else + echo "WARN: git not available, will check all migrations" + fi + - name: Check migration safety shell: sh run: | set -eu - python3 scripts/check_migration_safety.py --allow-medium-risk + if git rev-parse origin/main >/dev/null 2>&1; then + python3 scripts/check_migration_safety.py --allow-medium-risk --diff-against origin/main + else + python3 scripts/check_migration_safety.py --allow-medium-risk + fi - name: Run unit tests shell: sh