From d96389fcd0806599c5e30bb6c01b9d939e43da4a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 11 Apr 2026 06:43:56 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20README=E8=87=AA=E5=8A=A8=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E5=B7=A5=E4=BD=9C=E6=B5=81=E5=B9=B6=E5=8F=91=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=AB=9E=E4=BA=89=E6=9D=A1=E4=BB=B6=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=20=E2=80=94=20=E6=B7=BB=E5=8A=A0concurrency=E7=BB=84+rebase?= =?UTF-8?q?=E9=87=8D=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/3f372f1a-add7-477e-a6f0-2c247da2a941 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- .../workflows/readme-auto-update-on-merge.yml | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/.github/workflows/readme-auto-update-on-merge.yml b/.github/workflows/readme-auto-update-on-merge.yml index dc73535a..07bc2cd1 100644 --- a/.github/workflows/readme-auto-update-on-merge.yml +++ b/.github/workflows/readme-auto-update-on-merge.yml @@ -37,13 +37,19 @@ on: permissions: contents: write +# 防止并发运行:同一时间只允许一个实例,后触发的排队等待 +concurrency: + group: readme-auto-update + cancel-in-progress: false + jobs: update-readme: # 只在PR被合并时运行(不是关闭未合并),或push/手动触发 + # push 事件排除 [skip ci] 提交(防止自身触发循环) if: > - github.event_name == 'push' || github.event_name == 'workflow_dispatch' || - (github.event_name == 'pull_request' && github.event.pull_request.merged == true) + (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || + (github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]')) runs-on: ubuntu-latest timeout-minutes: 10 @@ -101,8 +107,25 @@ jobs: MSG="📡 README自动更新 · 手动触发 · $(TZ='Asia/Shanghai' date '+%Y-%m-%d %H:%M')" fi git commit -m "$MSG [skip ci]" - git push - echo "✅ README变更已提交并推送" + + # 推送前拉取远程变更,最多重试3次 + for i in 1 2 3; do + if ! git pull --rebase origin main; then + echo "⚠️ rebase 失败,尝试中止并重建提交..." + git rebase --abort 2>/dev/null || true + git pull --rebase origin main 2>/dev/null || true + fi + if git push; then + echo "✅ README变更已提交并推送 (第${i}次尝试)" + break + fi + if [ "$i" -eq 3 ]; then + echo "⚠️ 推送失败3次,跳过本次更新(下次触发时会重试)" + exit 0 + fi + echo "⚠️ 推送失败,${i}秒后重试..." + sleep "$i" + done else echo "ℹ️ 无变更需要提交" fi