From fa55c7669d258b1ac8db0be27251e1c3369bb9cb Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Thu, 16 Jul 2026 13:58:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(ci):=20Validate=E5=AD=90job=E6=9C=AB?= =?UTF-8?q?=E5=B0=BE=E6=89=8B=E5=8A=A8curl=E4=B8=8A=E6=8A=A5status?= =?UTF-8?q?=EF=BC=8C=E5=BD=BB=E5=BA=95=E8=A7=A3=E5=86=B3act-runner?= =?UTF-8?q?=E9=95=BF=E8=BF=9E=E6=8E=A5=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 根因:act-runner v0.2.6与Gitea的长连接不稳定,job执行完后结果状态经常报不上来,导致status一直pending。 修复:两个Validate子job末尾都加上手动curl上报status,成功时在检查脚本末尾直接POST success,失败时通过Report failure步骤POST failure。绕过act-runner内置的上报机制。 --- .gitea/workflows/ci-cd.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml index c871d2690..9970ab20b 100755 --- a/.gitea/workflows/ci-cd.yml +++ b/.gitea/workflows/ci-cd.yml @@ -134,6 +134,27 @@ jobs: echo "" echo "🎉 All code quality checks passed!" + echo "" + echo "=== Reporting success status to Gitea ===" + STATUS_URL="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" + curl -s -X POST "$STATUS_URL" \ + -H "Authorization: token ${GITHUB_TOKEN}" \ + -H "Content-Type: application/json" \ + -d '{"state":"success","context":"CI/CD Pipeline / Validate - Code Quality","description":"Code quality checks passed"}' > /dev/null 2>&1 + echo "Status reported successfully" + + - name: Report failure to Gitea + continue-on-error: true + if: failure() + shell: sh + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + echo "Reporting failure status to Gitea..." + STATUS_URL="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" + curl -s -X POST "$STATUS_URL" -H "Authorization: token ${GITHUB_TOKEN}" -H "Content-Type: application/json" -d '{"state":"failure","context":"CI/CD Pipeline / Validate - Code Quality","description":"Code quality checks failed"}' > /dev/null 2>&1 + echo "Failure status reported" + - name: Notify on failure continue-on-error: true if: failure()