fix(ci): 修复调度死锁+auto-approve/merge SHA错误 #478

Merged
auto-approve-bot merged 5 commits from ci/fix-sched-sha into develop 2026-07-17 17:02:48 +08:00
4 changed files with 18 additions and 10 deletions
+3 -2
View File
@@ -7,7 +7,7 @@ on:
jobs:
auto-approve:
name: Auto Approve on CI Green
runs-on: ci-l1
runs-on: ci-check
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
timeout-minutes: 20
steps:
@@ -20,6 +20,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
REVIEW_TOKEN: ${{ secrets.REVIEW_GITEA_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -eu
@@ -67,7 +68,7 @@ jobs:
# 调用辅助脚本检查每个context状态
for ctx in "${CONTEXTS[@]}"; do
STATE=$(python3 scripts/check_ci_status.py "$GITHUB_TOKEN" "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$ctx")
STATE=$(python3 scripts/check_ci_status.py "$GITHUB_TOKEN" "$GITHUB_REPOSITORY" "$PR_HEAD_SHA" "$ctx")
echo " $ctx: $STATE"
if [ "$STATE" != "success" ]; then
+3 -2
View File
@@ -7,7 +7,7 @@ on:
jobs:
auto-merge:
name: Auto Merge on CI Green + Approved
runs-on: ci-l1
runs-on: ci-check
if: github.event_name == 'pull_request' && !github.event.pull_request.draft && github.event.pull_request.base.ref == 'develop'
timeout-minutes: 30
steps:
@@ -20,6 +20,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
MERGE_TOKEN: ${{ secrets.REVIEW_GITEA_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
set -eu
@@ -65,7 +66,7 @@ jobs:
# 检查CI状态
for ctx in "${CONTEXTS[@]}"; do
STATE=$(python3 scripts/check_ci_status.py "$GITHUB_TOKEN" "$GITHUB_REPOSITORY" "$GITHUB_SHA" "$ctx")
STATE=$(python3 scripts/check_ci_status.py "$GITHUB_TOKEN" "$GITHUB_REPOSITORY" "$PR_HEAD_SHA" "$ctx")
echo " CI: ${ctx##*/}: $STATE"
if [ "$STATE" != "success" ]; then
ALL_SUCCESS=false
+4 -4
View File
@@ -24,7 +24,7 @@ concurrency:
jobs:
check-frontend-only:
name: Check if frontend-only change
runs-on: ci-l1
runs-on: ci-check
if: github.event_name == 'pull_request'
outputs:
skip_backend: ${{ steps.check.outputs.skip_backend }}
@@ -60,7 +60,7 @@ jobs:
needs: check-frontend-only
if: always() && needs.check-frontend-only.outputs.skip_backend != 'true'
name: Validate Code Quality And Tests
runs-on: ci-l1
runs-on: ci-check
timeout-minutes: 10
env:
DATABASE_URL: postgresql+psycopg://postgres:postgres@127.0.0.1:5432/xiaoxia_saas
@@ -412,7 +412,7 @@ jobs:
'
frontend-lint:
name: Frontend Lint
runs-on: ci-l1
runs-on: ci-check
timeout-minutes: 10
steps:
- name: Checkout code
@@ -459,4 +459,4 @@ jobs:
NOTIFY_MODE=failure JOB_NAME="Frontend Lint" python3 scripts/ci_notify.py
'
'
+8 -2
View File
@@ -34,10 +34,16 @@ def main():
# API返回按时间倒序,第一个就是最新的
for s in statuses:
if s.get("context") == target_context:
print(s.get("status", "pending"))
status = s.get("status", "pending")
# skipped 视为通过(条件跳过的任务不需要等)
if status == "skipped":
print("success")
else:
print(status)
return
print("pending")
# 找不到这个context也视为通过(该workflow没触发=不需要检查)
print("success")
if __name__ == "__main__":