Skip to content

ci: resolve PR number from head SHA in benchmark report - #2278

Merged
zeitlinger merged 1 commit into
mainfrom
fix/pr-benchmark-report-pr-lookup
Jul 8, 2026
Merged

ci: resolve PR number from head SHA in benchmark report#2278
zeitlinger merged 1 commit into
mainfrom
fix/pr-benchmark-report-pr-lookup

Conversation

@zeitlinger

Copy link
Copy Markdown
Member

Summary

The PR Benchmark Report workflow failed to comment on #2252 after a successful benchmark run (run 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

workflow_run.pull_requests is empty when the triggering run's head
branch is not on the default branch (or when the PR is from a fork),
so the report job produced a malformed URL and failed to comment on
the PR. Fall back to resolving the PR via the commits/{sha}/pulls
endpoint, and fail loudly if it still can't be determined.
Signed-off-by: Gregor Zeitlinger <gregor.zeitlinger@grafana.com>
@zeitlinger
zeitlinger marked this pull request as ready for review July 7, 2026 15:31
@zeitlinger
zeitlinger merged commit 79a5990 into main Jul 8, 2026
20 of 22 checks passed
@zeitlinger
zeitlinger deleted the fix/pr-benchmark-report-pr-lookup branch July 8, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants