fix(ci): 自检step移到Checkout之后——修复PR分支无脚本导致的误失败

This commit is contained in:
xiaoxia
2026-08-30 23:07:14 +08:00
committed by xiaoxia
parent 4a9d4edbec
commit a9c477bffc
+14 -15
View File
@@ -58,9 +58,8 @@ jobs:
echo "::warning::PR #${PR_NUMBER} 已合并,测试由合并后 push 流水线承接,PR 侧测试类 job 跳过"
exit 0
fi
# 情形2:同一 head_sha 已有在跑/排队的 push 流水线(rebase/ff 合并竞态)
# 情形3(增强):同一 head_sha 的 push 流水线已成功完成(竞态窗口内两边都通过了dedup,
# 此刻 push 已跑完时PR侧测试纯属重复,2026-08-30 双跑实测CPU超卖14分→30分)
# 情形2:同一 head_sha 已有在跑/排队/已成功的 push 流水线(rebase/ff 合并竞态;
# 已成功也去重——竞态窗口内两边都通过判断时,PR侧再跑全量测试纯属重复)
DUP=$(curl -sfH "Authorization: token $GITHUB_TOKEN" \
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/runs?head_sha=${HEAD_SHA}&per_page=30" \
| python3 -c "import json,sys; d=json.load(sys.stdin); runs=d if isinstance(d,list) else d.get('workflow_runs',d.get('runs',[])); hit=[r for r in runs if r.get('event')=='push' and (r.get('status') in ('in_progress','queued','waiting','pending') or r.get('conclusion')=='success')]; print('true' if hit else 'false')" || echo false)
@@ -140,13 +139,13 @@ jobs:
permissions:
contents: write
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -246,13 +245,13 @@ jobs:
permissions:
contents: read
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -333,13 +332,13 @@ jobs:
USE_IN_MEMORY_DB: 'false'
CI_USE_SHARED_PG: 'true'
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -422,13 +421,13 @@ jobs:
OSS_BUCKET_NAME: xiaoxia-autocut
OSS_ENDPOINT: oss-cn-hangzhou.aliyuncs.com
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -508,13 +507,13 @@ jobs:
OSS_BUCKET_NAME: xiaoxia-autocut
OSS_ENDPOINT: oss-cn-hangzhou.aliyuncs.com
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -568,13 +567,13 @@ jobs:
needs: [check-frontend-only, dedupe-check]
if: needs.dedupe-check.outputs.skip_tests != 'true' && needs.check-frontend-only.outputs.skip_frontend != 'true'
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -636,13 +635,13 @@ jobs:
needs: [check-frontend-only, dedupe-check]
if: always() && needs.dedupe-check.outputs.skip_tests != 'true' && needs.check-frontend-only.outputs.skip_frontend != 'true'
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -733,13 +732,13 @@ jobs:
cache_name: web-cache
timeout: 30
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -917,13 +916,13 @@ jobs:
cache_name: web-cache
timeout: 30
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -1296,13 +1295,13 @@ jobs:
if: success() && (github.ref_name == 'develop' || github.ref_name == 'main')
needs: deploy-staging
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -1349,13 +1348,13 @@ jobs:
if: success() && (github.ref_name == 'develop' || github.ref_name == 'main')
needs: deploy-staging
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
@@ -1429,13 +1428,13 @@ jobs:
cache_name: web-cache
timeout: 30
steps:
- name: Checkout code
- name: Zombie run selfcheck
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_RUN_ID: ${{ github.run_id }}
run: bash scripts/ci/ci_run_selfcheck.sh
- name: Checkout code
shell: sh
env:
GITHUB_TOKEN: ${{ github.token }}