Skip to content

Commit 7f44cbb

Browse files
authored
Merge pull request #1056 from louis-e/fix/pr-benchmark-pr-ref
Fix PR Benchmark to measure the PR head
2 parents 0832441 + 3c0fb05 commit 7f44cbb

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/pr-benchmark.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ permissions:
66

77
on:
88
pull_request:
9-
types: [opened, reopened]
9+
types: [opened, reopened, synchronize]
1010
issue_comment:
1111
types: [created]
1212

@@ -19,7 +19,13 @@ jobs:
1919
contains(github.event.comment.body, 'retrigger-benchmark'))
2020
runs-on: ubuntu-latest
2121
steps:
22+
# Check out the PR head so comment-triggered runs benchmark the PR, not main.
2223
- uses: actions/checkout@v6
24+
with:
25+
ref: refs/pull/${{ github.event.pull_request.number || github.event.issue.number }}/head
26+
- name: Resolve benchmarked commit
27+
id: commit
28+
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
2329
- uses: ./.github/actions/setup-arnis-linux
2430
with:
2531
gui-deps: "false"
@@ -60,6 +66,8 @@ jobs:
6066
6167
- name: Format duration and generate summary
6268
id: comment_body
69+
env:
70+
COMMIT_SHA: ${{ steps.commit.outputs.sha }}
6371
run: |
6472
duration=${{ steps.end_time.outputs.duration }}
6573
minutes=$((duration / 60))
@@ -127,7 +135,7 @@ jobs:
127135
echo ""
128136
echo "📈 Compared against baseline: **${baseline_time}s** time, **${baseline_mem} MB** memory"
129137
echo "🧮 Delta: **${diff}s** time, **${mem_diff} MB** memory"
130-
echo "🔢 Commit: [\`${GITHUB_SHA:0:7}\`](https://github.com/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA})"
138+
echo "🔢 Commit: [\`${COMMIT_SHA:0:7}\`](https://github.com/${GITHUB_REPOSITORY}/commit/${COMMIT_SHA})"
131139
echo ""
132140
echo "${verdict}"
133141
echo "${mem_verdict}"

0 commit comments

Comments
 (0)