Skip to content

Commit bcf4e5f

Browse files
committed
fix: resolve PR number for workflow_dispatch so benchmark results post to PR
The gate job was skipping PR-specific outputs for manual workflow_dispatch runs, which caused the "Post benchmark results as PR comment" step to be skipped. Now the gate job looks up open PRs for the current branch and sets pr_number/pr_head_sha when found. Made-with: Cursor
1 parent 01c6d8a commit bcf4e5f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/ci-benchmark.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,22 @@ jobs:
7878
7979
core.setOutput('run_benchmark', 'true');
8080
core.setOutput('platform', platform);
81-
// Don't set PR-specific outputs for manual runs
81+
82+
// Try to find a PR for the current branch so we can post results
83+
const branch = context.ref.replace('refs/heads/', '');
84+
const { data: prs } = await github.rest.pulls.list({
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
head: `${context.repo.owner}:${branch}`,
88+
state: 'open',
89+
});
90+
if (prs.length > 0) {
91+
core.setOutput('pr_number', prs[0].number.toString());
92+
core.setOutput('pr_head_sha', prs[0].head.sha);
93+
console.log(`Found open PR #${prs[0].number} for branch ${branch}`);
94+
} else {
95+
console.log(`No open PR found for branch ${branch}, skipping PR outputs`);
96+
}
8297
return;
8398
}
8499

0 commit comments

Comments
 (0)