From ca1829c3f4ed69b25331e5e74fcdfe1845a8ba74 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 28 May 2026 05:31:56 +0100 Subject: [PATCH] fix(ci): bound optional performance report publishing --- .github/workflows/openclaw-performance.yml | 17 +++++++++++++---- .../openclaw-performance-workflow.test.ts | 13 +++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/openclaw-performance.yml b/.github/workflows/openclaw-performance.yml index 53df3d8b780..2c18f281467 100644 --- a/.github/workflows/openclaw-performance.yml +++ b/.github/workflows/openclaw-performance.yml @@ -551,25 +551,31 @@ jobs: retention-days: ${{ matrix.deep_profile == 'true' && 14 || 30 }} - name: Prepare clawgrit reports checkout + id: clawgrit_reports if: ${{ steps.kova.outputs.report_json != '' && steps.clawgrit.outputs.present == 'true' }} env: CLAWGRIT_REPORTS_TOKEN: ${{ secrets.CLAWGRIT_REPORTS_TOKEN }} shell: bash run: | set -euo pipefail + echo "ready=false" >> "$GITHUB_OUTPUT" reports_root=".artifacts/clawgrit-reports" mkdir -p "$reports_root" git -C "$reports_root" init -b main git -C "$reports_root" remote add origin "https://x-access-token:${CLAWGRIT_REPORTS_TOKEN}@github.com/openclaw/clawgrit-reports.git" - if git -C "$reports_root" ls-remote --exit-code --heads origin main >/dev/null 2>&1; then - git -C "$reports_root" fetch --depth=1 origin main + if timeout 60s git -C "$reports_root" ls-remote --exit-code --heads origin main >/dev/null 2>&1; then + if ! timeout 120s git -C "$reports_root" fetch --depth=1 origin main; then + echo "::warning::Skipping optional clawgrit report publish because the reports checkout fetch timed out or failed." + exit 0 + fi git -C "$reports_root" checkout -B main FETCH_HEAD else git -C "$reports_root" checkout -B main fi + echo "ready=true" >> "$GITHUB_OUTPUT" - name: Publish to clawgrit reports - if: ${{ steps.kova.outputs.report_json != '' && steps.clawgrit.outputs.present == 'true' }} + if: ${{ steps.kova.outputs.report_json != '' && steps.clawgrit.outputs.present == 'true' && steps.clawgrit_reports.outputs.ready == 'true' }} env: CLAWGRIT_REPORTS_TOKEN: ${{ secrets.CLAWGRIT_REPORTS_TOKEN }} shell: bash @@ -642,6 +648,9 @@ jobs: exit 0 fi sleep $((attempt * 2)) - git -C "$reports_root" fetch --depth=1 origin main + timeout 120s git -C "$reports_root" fetch --depth=1 origin main || { + echo "::warning::Skipping optional clawgrit report rebase because the reports fetch timed out or failed." + exit 0 + } git -C "$reports_root" rebase FETCH_HEAD done diff --git a/test/scripts/openclaw-performance-workflow.test.ts b/test/scripts/openclaw-performance-workflow.test.ts index 4cd67e4699e..fd483fe752e 100644 --- a/test/scripts/openclaw-performance-workflow.test.ts +++ b/test/scripts/openclaw-performance-workflow.test.ts @@ -6,6 +6,7 @@ const WORKFLOW = ".github/workflows/openclaw-performance.yml"; type WorkflowStep = { name?: string; + if?: string; run?: string; env?: Record; }; @@ -44,4 +45,16 @@ describe("OpenClaw performance workflow", () => { ); expect(publish.run).toContain('git -C "$reports_root" push origin HEAD:main'); }); + + it("keeps optional clawgrit report publishing bounded", () => { + const prepare = findStep("Prepare clawgrit reports checkout"); + const publish = findStep("Publish to clawgrit reports"); + + expect(prepare.run).toContain('echo "ready=false" >> "$GITHUB_OUTPUT"'); + expect(prepare.run).toContain("timeout 60s git"); + expect(prepare.run).toContain("timeout 120s git"); + expect(prepare.run).toContain('echo "ready=true" >> "$GITHUB_OUTPUT"'); + expect(publish.if).toContain("steps.clawgrit_reports.outputs.ready == 'true'"); + expect(publish.run).toContain("timeout 120s git"); + }); });