fix(ci): auto-approve使用PR head SHA而非merge SHA检查CI状态
Auto Merge PRs (main) / Auto Merge on CI Green + Approved (main) (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 10s
CI/CD Pipeline / Validate Code Quality And Tests (pull_request) Failing after 29s
Auto Approve CI PRs / Auto Approve on CI Green (pull_request) Successful in 51s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 44s
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
CI/CD Pipeline / Frontend Lint (pull_request) Has been cancelled

pull_request事件中GITHUB_SHA是merge commit的虚拟SHA,CI实际运行的是head SHA。
用merge SHA查status永远查不到,导致auto-approve一直看到pending,20分钟超时后退出,
永远打不了审批。改用github.event.pull_request.head.sha查询。
This commit is contained in:
2026-07-17 15:35:41 +08:00
parent 82ad237b92
commit eeabeb480a
+2 -1
View File
@@ -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
@@ -79,7 +80,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