Skip to content

Commit 65c81c0

Browse files
Merge pull request #182 from ember-tooling/copilot/fix-bench-script-for-gh
Fix bench-compare workflow for fork PRs
2 parents 4b89849 + 9d60b2e commit 65c81c0

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/bench-compare.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ jobs:
1818

1919
steps:
2020
- uses: actions/checkout@v6
21+
id: checkout
2122
with:
2223
# Full history so the script can git-archive the base branch.
2324
fetch-depth: 0
24-
ref: ${{ github.head_ref }}
25+
# Use the PR head SHA so fork PRs resolve correctly
26+
# (github.head_ref is a branch name that only exists on the fork remote).
27+
ref: ${{ github.event.pull_request.head.sha }}
2528

2629
- uses: wyvox/action-setup-pnpm@v3
2730

@@ -33,19 +36,19 @@ jobs:
3336
pnpm bench:compare | sed 's/\x1b\[[0-9;]*m//g' > "$RUNNER_TEMP/bench-output.txt"
3437
3538
- name: Format PR comment
36-
if: always()
39+
if: always() && steps.checkout.outcome == 'success'
3740
env:
3841
BENCH_OUTPUT_FILE: ${{ runner.temp }}/bench-output.txt
3942
BENCH_JSON_OUTPUT: ${{ runner.temp }}/bench-results.json
4043
BENCH_JOB_SUCCESS: ${{ job.status == 'success' }}
4144
run: node scripts/format-bench-comment.mjs > "$RUNNER_TEMP/bench-comment.md"
4245

4346
- name: Write job summary
44-
if: always()
47+
if: always() && steps.checkout.outcome == 'success'
4548
run: cat "$RUNNER_TEMP/bench-comment.md" >> "$GITHUB_STEP_SUMMARY"
4649

4750
- name: Post PR comment
48-
if: always()
51+
if: always() && steps.checkout.outcome == 'success'
4952
uses: actions/github-script@v7
5053
with:
5154
script: |

0 commit comments

Comments
 (0)