From b70b29230d9f991496397efce9d4d54b166877b0 Mon Sep 17 00:00:00 2001 From: Paka-418 Date: Mon, 16 Nov 2026 17:49:02 +0800 Subject: [PATCH 1/4] =?UTF-8?q?chore(ci):=20=E8=8A=82=E7=9C=81=20runner=20?= =?UTF-8?q?=E6=97=B6=E9=97=B4=EF=BC=9A=E8=B7=AF=E5=BE=84=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E3=80=81=E5=B9=B6=E5=8F=91=E5=8F=96=E6=B6=88=E3=80=81=E5=87=BA?= =?UTF-8?q?=E5=8F=A3=E6=8E=A2=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CI Check 增加 paths-ignore:只改 .github/**、README、LICENSE 的 PR 不再触发 - CI Check 增加 concurrency:同一 PR 连推只跑最新一次 - CI Check / Deploy 增加 github.com 可达性探测(30 秒内失败), 避免出口故障时 checkout 三次重试白跑 7 分钟 - 两个工作流增加 timeout-minutes: 20 兜底 Co-Authored-By: Claude Code --- .github/workflows/ci-check.yml | 27 ++++++++++++++++++++++++++- .github/workflows/deploy.yml | 23 ++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index 0f27819fc..dac946d89 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -3,11 +3,36 @@ name: CI Check on: pull_request: branches: [main] + # 纯元数据改动不触发:workflow 本身、README、许可证都不影响站点构建 + paths-ignore: + - '.github/**' + - 'README.md' + - 'LICENSE*' + +# 同一 PR 连推多次时取消旧任务,只保留最新一次 +concurrency: + group: ci-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: build: runs-on: self-hosted + timeout-minutes: 20 steps: + # runner 到 github.com 偶发断连;先做 30 秒内的可达性探测, + # 避免 checkout 三次重试各等 2 分钟以上(一次故障白跑 7 分钟) + - name: Probe github.com egress + run: | + for i in 1 2 3; do + if curl -sS --max-time 10 -o /dev/null https://github.com; then + echo "github.com reachable (attempt $i)" + exit 0 + fi + echo "Attempt $i failed, retrying..." + sleep 5 + done + echo "::error::github.com unreachable from runner" + exit 1 - uses: actions/checkout@v5 - name: Detect local Node.js on runner id: detect_node @@ -41,4 +66,4 @@ jobs: - if: always() run: | echo "## Build Summary" >> $GITHUB_STEP_SUMMARY - echo "- **Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY \ No newline at end of file + echo "- **Status**: ${{ job.status }}" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 20e8332ca..96dd4087b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,13 +6,34 @@ on: - main # 当 main 分支有推送时触发部署 workflow_dispatch: # 允许手动触发 +# 部署串行执行,不取消进行中的任务:取消可能留下半套 gh-pages 产物 +concurrency: + group: deploy-main + cancel-in-progress: false + jobs: build: runs-on: self-hosted + timeout-minutes: 20 env: GUAJI_ASSISTANT_ORIGIN: https://developer.d-robotics.cc steps: + # runner 到 github.com 偶发断连;先做 30 秒内的可达性探测, + # 避免 checkout 三次重试各等 2 分钟以上(一次故障白跑 7 分钟) + - name: Probe github.com egress + run: | + for i in 1 2 3; do + if curl -sS --max-time 10 -o /dev/null https://github.com; then + echo "github.com reachable (attempt $i)" + exit 0 + fi + echo "Attempt $i failed, retrying..." + sleep 5 + done + echo "::error::github.com unreachable from runner" + exit 1 + - name: Checkout repository uses: actions/checkout@v5 @@ -28,7 +49,7 @@ jobs: run: | git config --global user.email "liql01@qq.com" git config --global user.name "liqinglian01" - + - name: Setup SSH run: | mkdir -p ~/.ssh From 2a62a83820cd00d6726b544182f81c00c10f745c Mon Sep 17 00:00:00 2001 From: Paka-418 Date: Mon, 16 Nov 2026 17:50:09 +0800 Subject: [PATCH 2/4] =?UTF-8?q?chore(ci):=20=E6=94=B9=E7=94=A8=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E5=88=A4=E6=96=AD=E8=B7=B3=E8=BF=87=E9=87=8D=E6=B4=BB?= =?UTF-8?q?=EF=BC=8C=E4=BF=9D=E6=8C=81=20build=20=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E5=A7=8B=E7=BB=88=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit paths-ignore 会让必需检查 build 不上报,GitHub 视为未完成而阻塞合并。 改为 workflow 照常触发、checkout 后判断改动是否只含元数据, 只含则跳过安装/构建,job 仍以成功状态上报 build。 Co-Authored-By: Claude Code --- .github/workflows/ci-check.yml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index dac946d89..250c2cd60 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -3,11 +3,6 @@ name: CI Check on: pull_request: branches: [main] - # 纯元数据改动不触发:workflow 本身、README、许可证都不影响站点构建 - paths-ignore: - - '.github/**' - - 'README.md' - - 'LICENSE*' # 同一 PR 连推多次时取消旧任务,只保留最新一次 concurrency: @@ -34,7 +29,20 @@ jobs: echo "::error::github.com unreachable from runner" exit 1 - uses: actions/checkout@v5 + # 只改 workflow / README / LICENSE 的 PR 不影响站点构建: + # 保留 job(必需检查 build 必须上报),跳过全部重活 + - name: Detect metadata-only changes + id: meta + run: | + git fetch --no-tags --depth=1 origin "${{ github.base_ref }}" + if git diff --quiet FETCH_HEAD...HEAD -- . ':(exclude).github/**' ':(exclude)README.md' ':(exclude)LICENSE*'; then + echo "skip=true" >> "$GITHUB_OUTPUT" + echo "Only metadata files changed; skipping build." + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi - name: Detect local Node.js on runner + if: steps.meta.outputs.skip != 'true' id: detect_node run: | if command -v node >/dev/null 2>&1 && command -v npm >/dev/null 2>&1; then @@ -46,22 +54,25 @@ jobs: echo "has_node=false" >> "$GITHUB_OUTPUT" fi - name: Setup Node.js (fallback if runner has no Node) - if: steps.detect_node.outputs.has_node != 'true' + if: steps.meta.outputs.skip != 'true' && steps.detect_node.outputs.has_node != 'true' uses: actions/setup-node@v5 with: node-version: '24' cache: 'npm' - name: Doc quality (advisory) + if: steps.meta.outputs.skip != 'true' uses: D-Robotics/doc-skills/.github/actions/doc-quality@v1 continue-on-error: true with: changed-only: 'true' advisory: 'true' - name: Clean install dependencies + if: steps.meta.outputs.skip != 'true' run: | rm -rf node_modules npm ci - name: Build site (strict broken-link checking) + if: steps.meta.outputs.skip != 'true' run: npm run build:ci - if: always() run: | From 96df997c8c72eee41a4e22b06cb4e87147d082b7 Mon Sep 17 00:00:00 2001 From: Paka-418 Date: Mon, 16 Nov 2026 17:50:41 +0800 Subject: [PATCH 3/4] =?UTF-8?q?chore(ci):=20=E7=94=A8=20merge-base=20?= =?UTF-8?q?=E5=88=A4=E6=96=AD=E6=94=B9=E5=8A=A8=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=B5=85=E5=85=8B=E9=9A=86=E6=8B=BF=E4=B8=8D=E5=88=B0=E5=85=B1?= =?UTF-8?q?=E5=90=8C=E7=A5=96=E5=85=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Code --- .github/workflows/ci-check.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index 250c2cd60..d7338ec00 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -34,8 +34,9 @@ jobs: - name: Detect metadata-only changes id: meta run: | - git fetch --no-tags --depth=1 origin "${{ github.base_ref }}" - if git diff --quiet FETCH_HEAD...HEAD -- . ':(exclude).github/**' ':(exclude)README.md' ':(exclude)LICENSE*'; then + git fetch --no-tags --depth=50 origin "${{ github.base_ref }}" || true + base=$(git merge-base FETCH_HEAD HEAD 2>/dev/null || echo "") + if [ -n "$base" ] && git diff --quiet "$base" HEAD -- . ':(exclude).github/**' ':(exclude)README.md' ':(exclude)LICENSE*'; then echo "skip=true" >> "$GITHUB_OUTPUT" echo "Only metadata files changed; skipping build." else From 1c96c17b0323facedabe0022cd30ad0ef948cf40 Mon Sep 17 00:00:00 2001 From: Paka-418 Date: Mon, 16 Nov 2026 18:07:02 +0800 Subject: [PATCH 4/4] =?UTF-8?q?chore(ci):=20=E7=94=A8=20PR=20=E5=88=86?= =?UTF-8?q?=E6=94=AF=E4=B8=8E=20base=20=E5=88=86=E6=94=AF=E6=AF=94?= =?UTF-8?q?=E8=BE=83=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=B5=85=E5=85=8B=E9=9A=86?= =?UTF-8?q?=E4=B8=8B=20merge-base=20=E6=8B=BF=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Code --- .github/workflows/ci-check.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml index d7338ec00..df4ba3b08 100644 --- a/.github/workflows/ci-check.yml +++ b/.github/workflows/ci-check.yml @@ -34,13 +34,17 @@ jobs: - name: Detect metadata-only changes id: meta run: | + # checkout 的是浅克隆的 PR merge commit,拿不到共同祖先; + # 改为分别取 PR 分支和 base 分支的最新提交再比较 + git fetch --no-tags --depth=50 origin "+refs/heads/${{ github.head_ref }}:refs/remotes/pr-head" || true git fetch --no-tags --depth=50 origin "${{ github.base_ref }}" || true - base=$(git merge-base FETCH_HEAD HEAD 2>/dev/null || echo "") - if [ -n "$base" ] && git diff --quiet "$base" HEAD -- . ':(exclude).github/**' ':(exclude)README.md' ':(exclude)LICENSE*'; then + base=$(git merge-base FETCH_HEAD refs/remotes/pr-head 2>/dev/null) + if [ -n "$base" ] && git diff --quiet "$base" refs/remotes/pr-head -- . ':(exclude).github/**' ':(exclude)README.md' ':(exclude)LICENSE*'; then echo "skip=true" >> "$GITHUB_OUTPUT" echo "Only metadata files changed; skipping build." else echo "skip=false" >> "$GITHUB_OUTPUT" + echo "Source changes detected (or merge-base unavailable); running full build." fi - name: Detect local Node.js on runner if: steps.meta.outputs.skip != 'true'