From 09697f4230c4ec3eac456945bc3c1d20010e8add Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 22 Jul 2026 17:04:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=A4=8Dpr-auto-scan?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E8=B7=AF=E5=BE=84=E4=B8=8D=E4=B8=80=E8=87=B4?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E5=AE=9A=E6=97=B6=E6=89=AB=E6=8F=8F=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/pr-auto-scan.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/pr-auto-scan.yml b/.gitea/workflows/pr-auto-scan.yml index 1e3dfe55a..8621ce69e 100644 --- a/.gitea/workflows/pr-auto-scan.yml +++ b/.gitea/workflows/pr-auto-scan.yml @@ -40,7 +40,7 @@ jobs: echo "时间: $(date)" echo - python3 scripts/ci/pr_auto_scan.py --token "$REVIEW_TOKEN" --repo "$GITHUB_REPOSITORY" --base develop --approve --merge --dry-run false + python3 /tmp/pr_auto_scan.py --token "$REVIEW_TOKEN" --repo "$GITHUB_REPOSITORY" --base develop --approve --merge --dry-run false echo "" echo "✅ 扫描完成" -- 2.54.0 From fde3ab3063cac494ebdb475074b9d4605aa10e97 Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 22 Jul 2026 17:09:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix(ci):=20auto=5Ffix=E5=8F=98=E9=87=8F?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F+REVIEW=5FTOKEN=E6=8E=A8=E9=80=81=E8=A7=A6?= =?UTF-8?q?=E5=8F=91=E6=96=B0CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci-pipeline.yml | 1 + scripts/ci/auto_fix_formatting.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci-pipeline.yml b/.gitea/workflows/ci-pipeline.yml index 12c247b0b..9be9712ce 100755 --- a/.gitea/workflows/ci-pipeline.yml +++ b/.gitea/workflows/ci-pipeline.yml @@ -130,6 +130,7 @@ jobs: shell: sh env: GITHUB_TOKEN: ${{ github.token }} + REVIEW_TOKEN: ${{ secrets.REVIEW_GITEA_TOKEN }} run: python3 scripts/ci/auto_fix_formatting.py - name: CI failure notification if: failure() diff --git a/scripts/ci/auto_fix_formatting.py b/scripts/ci/auto_fix_formatting.py index f36a78adc..4edd97f1c 100755 --- a/scripts/ci/auto_fix_formatting.py +++ b/scripts/ci/auto_fix_formatting.py @@ -168,6 +168,8 @@ def main(): return api_url = os.environ.get("GITHUB_API_URL", "") + repo = os.environ.get("GITHUB_REPOSITORY", "") + token = os.environ.get("REVIEW_TOKEN", "") or os.environ.get("GITHUB_TOKEN", "") # 获取PR作者信息,判断是人还是Agent提交的 pr_info_url = f"{api_url}/repos/{repo}/pulls/{pr_number}" @@ -190,13 +192,11 @@ def main(): print(f"检测到人提交的PR(作者: {pr_author}),仅诊断不自动修改") print("(如需自动修复,请用Agent账号提交PR,或手动运行格式化脚本)") fix_mode = "diagnose_only" - repo = os.environ.get("GITHUB_REPOSITORY", "") - token = os.environ.get("GITHUB_TOKEN", "") scan_mode = os.environ.get("SCAN_MODE", "full") changed_files_env = os.environ.get("CHANGED_FILES", "") if not token: - print("缺少GITHUB_TOKEN,无法推送修复", file=sys.stderr) + print("缺少REVIEW_TOKEN或GITHUB_TOKEN,无法推送修复", file=sys.stderr) sys.exit(1) repo_root = os.getcwd() -- 2.54.0 From 34e5b18a30453f08ae30e79b2d3ee7e8027f1edc Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 22 Jul 2026 17:43:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?fix(ci):=20=E4=BF=AE=E5=A4=8DCI=20rerun?= =?UTF-8?q?=E6=97=B6=E6=95=B0=E6=8D=AE=E5=BA=93=E5=91=BD=E5=90=8D=E5=86=B2?= =?UTF-8?q?=E7=AA=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在CREATE DATABASE前先执行DROP DATABASE IF EXISTS WITH (FORCE), 防止rerun同一run_id时因数据库已存在而失败。 影响:validate_migration.sh / run_integration_tests.sh / run_validate.sh --- scripts/ci/run_integration_tests.sh | 1 + scripts/ci/run_validate.sh | 1 + scripts/ci/validate_migration.sh | 1 + 3 files changed, 3 insertions(+) diff --git a/scripts/ci/run_integration_tests.sh b/scripts/ci/run_integration_tests.sh index 9f7975478..1fca1158f 100755 --- a/scripts/ci/run_integration_tests.sh +++ b/scripts/ci/run_integration_tests.sh @@ -196,6 +196,7 @@ import psycopg2 conn = psycopg2.connect(host='$SHARED_PG_HOST', port=$SHARED_PG_PORT, user='$SHARED_PG_USER', password='$SHARED_PG_PASSWORD', dbname='postgres') conn.autocommit = True cur = conn.cursor() +cur.execute(f'DROP DATABASE IF EXISTS \"$CI_DB_NAME\" WITH (FORCE)') cur.execute(f'CREATE DATABASE \"$CI_DB_NAME\"') cur.close() conn.close() diff --git a/scripts/ci/run_validate.sh b/scripts/ci/run_validate.sh index da70cf245..050a82b94 100755 --- a/scripts/ci/run_validate.sh +++ b/scripts/ci/run_validate.sh @@ -408,6 +408,7 @@ import psycopg2 conn = psycopg2.connect(host='$SHARED_PG_HOST', port=$SHARED_PG_PORT, user='$SHARED_PG_USER', password='$SHARED_PG_PASSWORD', dbname='postgres') conn.autocommit = True cur = conn.cursor() +cur.execute(f'DROP DATABASE IF EXISTS \"$CI_DB_NAME\" WITH (FORCE)') cur.execute(f'CREATE DATABASE \"$CI_DB_NAME\"') cur.close() conn.close() diff --git a/scripts/ci/validate_migration.sh b/scripts/ci/validate_migration.sh index 998dc1651..48243dd3d 100644 --- a/scripts/ci/validate_migration.sh +++ b/scripts/ci/validate_migration.sh @@ -112,6 +112,7 @@ import psycopg2 conn = psycopg2.connect(host='$SHARED_PG_HOST', port=$SHARED_PG_PORT, user='$SHARED_PG_USER', password='$SHARED_PG_PASSWORD', dbname='postgres') conn.autocommit = True cur = conn.cursor() +cur.execute(f'DROP DATABASE IF EXISTS \"$CI_DB_NAME\" WITH (FORCE)') cur.execute(f'CREATE DATABASE \"$CI_DB_NAME\"') cur.close() conn.close() -- 2.54.0