From 7ec968261e14be256cc8b9930b0c188478a124d0 Mon Sep 17 00:00:00 2001 From: OhYee Date: Thu, 7 May 2026 16:00:49 +0800 Subject: [PATCH] ci: skip-existing on PyPI publish to unblock concurrent PR pushes When a PR is pushed multiple times in quick succession (or two CI runs race), the version-bump step can compute the same next version twice because PyPI's JSON API has a small cache window after a release. The second 'Publish to PyPI' then fails with HTTP 400 "File already exists", marking the entire CI run red and blocking PR merge even though tests, type-check, build and verify all passed. Add skip-existing: true so the publish action treats an existing version as a non-error (it logs a warning and exits 0). PR merge is no longer gated by this race. Side note: skip-existing means the second push's *content* won't be republished under the same version. The proper long-term fix is to embed the commit SHA in the dev version (e.g. 0.0.187+sha.) so each push gets a unique artefact. Tracked separately. release-test.yml is intentionally left unchanged: it is triggered manually with an explicit version bump, where a conflict should fail loudly rather than be silently skipped. Change-Id: I4be2fb05fd06e32b83dd64d52bd62bfe8b8355cf Co-developed-by: Claude Signed-off-by: OhYee --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fff203d..eaa278e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,6 +163,10 @@ jobs: with: password: ${{ secrets.PYPI_API_TOKEN }} verify-metadata: false + # 当 PR 多次 push 或并发 CI 跑出相同版本号时,跳过已存在版本而非报错。 + # 根因是版本号自增逻辑依赖 PyPI API 拉取最新版本,存在缓存/并发窗口。 + # 不阻塞 PR 合入即可,长期方案是在版本号中嵌入 commit SHA 实现唯一化。 + skip-existing: true - name: Create and push tag if: steps.changes.outputs.agentrun_changed == 'true'