diff --git a/.github/workflows/bench-compare.yml b/.github/workflows/bench-compare.yml index 66716a9..7f9cd33 100644 --- a/.github/workflows/bench-compare.yml +++ b/.github/workflows/bench-compare.yml @@ -18,10 +18,13 @@ jobs: steps: - uses: actions/checkout@v6 + id: checkout with: # Full history so the script can git-archive the base branch. fetch-depth: 0 - ref: ${{ github.head_ref }} + # Use the PR head SHA so fork PRs resolve correctly + # (github.head_ref is a branch name that only exists on the fork remote). + ref: ${{ github.event.pull_request.head.sha }} - uses: wyvox/action-setup-pnpm@v3 @@ -33,7 +36,7 @@ jobs: pnpm bench:compare | sed 's/\x1b\[[0-9;]*m//g' > "$RUNNER_TEMP/bench-output.txt" - name: Format PR comment - if: always() + if: always() && steps.checkout.outcome == 'success' env: BENCH_OUTPUT_FILE: ${{ runner.temp }}/bench-output.txt BENCH_JSON_OUTPUT: ${{ runner.temp }}/bench-results.json @@ -41,11 +44,11 @@ jobs: run: node scripts/format-bench-comment.mjs > "$RUNNER_TEMP/bench-comment.md" - name: Write job summary - if: always() + if: always() && steps.checkout.outcome == 'success' run: cat "$RUNNER_TEMP/bench-comment.md" >> "$GITHUB_STEP_SUMMARY" - name: Post PR comment - if: always() + if: always() && steps.checkout.outcome == 'success' uses: actions/github-script@v7 with: script: |