ci: Fix PR resolution in CI Summary Report publish workflow#8159
Conversation
Signed-off-by: Yuri Shkuro <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR improves CI summary publishing by persisting the PR number into the ci-summary artifact and updating the publish workflow to read the PR number from that artifact (rather than relying on workflow_run.pull_requests[], which can be empty for fork PRs). It also changes the manual publish path to accept an explicit CI Orchestrator run_id.
Changes:
- Write
pr_numberinto.artifacts/ci-summary.jsonfrom the CI Orchestrator run. - Add
workflow_dispatchinputrun_idand resolvehead_shadirectly from the run. - For
workflow_runtriggers, readpr_numberfrom the downloadedci-summary.json.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| .github/workflows/ci-summary-report.yml | Adds PR_NUMBER env and emits pr_number into the structured ci-summary.json artifact. |
| .github/workflows/ci-summary-report-publish.yml | Adds run_id input and changes PR number resolution to come from the ci-summary artifact. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Signed-off-by: Yuri Shkuro <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8159 +/- ##
==========================================
+ Coverage 95.67% 95.70% +0.02%
==========================================
Files 317 317
Lines 16746 16746
==========================================
+ Hits 16022 16026 +4
+ Misses 571 568 -3
+ Partials 153 152 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes a bug where
ci-summary-report-publish.ymlposted a comment to a completely wrong PR (#1) when the CI Orchestrator was triggered by a push tomain. This happened becauseworkflow_run.pull_requests[]can contain spurious matches for push events — GitHub populates it with any open PR whose head SHA matches the pushed commit.Root Cause
The publish workflow resolved
PR_NUMBERfromgithub.event.workflow_run.pull_requests[0].number. For push events, this array is unreliable and returned PR #1, a completely unrelated PR. See the failing run.Changes
ci-summary-report.yml: Storepr_number(fromgithub.event.pull_request.number) inci-summary.json. This is accurate because the workflow runs inside the CI Orchestrator, where the event payload is trustworthy. For push/merge_group events the value isnull.ci-summary-report-publish.yml: Simplified PR resolution:workflow_run: Readpr_numberfrom the downloadedci-summary.jsonartifact instead of the unreliable event payload. Removed allpull_requests[]access andgh pr listfallback.workflow_dispatch: Now requires bothrun_idandpr_numberas inputs, eliminating API lookups to find the CI Orchestrator run.The "Resolve source run" step went from ~45 lines of convoluted shell with multiple API calls to ~20 straightforward lines.
AI Usage in this PR (choose one)
See AI Usage Policy.