Commit 79a5990
authored
ci: resolve PR number from head SHA in benchmark report (#2278)
## Summary
The `PR Benchmark Report` workflow failed to comment on
[#2252](#2252) after a
successful benchmark run ([run
28865892835](https://github.com/prometheus/client_java/actions/runs/28865892835)):
```
gh: Not Found (HTTP 404)
parse "https://api.github.com/repos/prometheus/client_java/issues/comments/{\r": net/url: invalid control character in URL
```
Root cause: `workflow_run.pull_requests` is empty when the triggering
run's head branch is not on the default branch (or the PR is from a
fork). With `PR_NUMBER` empty, the subsequent
`repos/${REPO}/issues//comments` API call 404s and the paginator emits a
malformed URL, so no comment gets posted.
## Changes
- Fall back to `repos/{owner}/{repo}/commits/{sha}/pulls` to resolve the
PR from the head SHA when `workflow_run.pull_requests` is empty.
- Fail fast with an explicit error if the PR still can't be resolved, so
future regressions don't cascade into cryptic URL-parse errors.
## Test plan
- [ ] Re-run the report workflow against run 28861406560 (or a fresh
push to #2252) and confirm a benchmark comment lands on the PR.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>1 parent 4dc54da commit 79a5990
1 file changed
Lines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
36 | 47 | | |
37 | 48 | | |
38 | 49 | | |
| |||
0 commit comments