Skip to content

feat(ci): publish build-matrix results as a sticky PR comment#36

Merged
monsieurleberre merged 3 commits into
devfrom
feat/21-matrix-sticky-comment
Jul 14, 2026
Merged

feat(ci): publish build-matrix results as a sticky PR comment#36
monsieurleberre merged 3 commits into
devfrom
feat/21-matrix-sticky-comment

Conversation

@monsieurleberre

Copy link
Copy Markdown
Contributor

Closes #21.

Summary

csharp-ci.yaml@v2 and scala-ci.yaml@v2 support an OS × arch build-matrix, but per-shard results were only visible in the PR checks panel. This adds a matrix-comment aggregator job to both reusable workflows that posts the shard results as a sticky PR comment.

Details

  • New matrix-comment job: needs: build-and-test, if: ${{ !cancelled() && inputs.build-matrix != '' && github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}. It renders even when a shard fails (the case where the table is most useful), and no-ops when no build-matrix is passed, on non-PR events, and for dependabot.
  • Queries per-shard outcomes via gh api --paginate .../actions/runs/${GITHUB_RUN_ID}/jobs, then upserts a shard | result | duration markdown table (each shard links to its job) via marocchino/sticky-pull-request-comment — same pin as the coverage comment, under a distinct <artifact-prefix>-build-matrix header so it never clobbers the coverage comment.
  • scripts/render_matrix_comment.py (new): self-anchors on the aggregator's own job name to isolate its shards from sibling reusable-workflow jobs sharing github.run_id; fails loud on unknown conclusions, a missing/duplicate self-job, or no shards. Helpers checked out at job.workflow_sha (no bare local action path).
  • test/render_matrix_comment_test.py (new): 10 hermetic tests — sorting, links, durations, sibling-workflow isolation, paginated parsing, and every loud-failure path. Auto-discovered by the build-and-test self-test job.

Verification

  • actionlint clean on both workflows; full python3 -m unittest discover = 62 pass.
  • Pre-open review: FIX → fixed → SHIP. The reviewer caught a CHANGELOG blocker (an accidental deletion of the ## [2.3.4] release heading) — now restored, CHANGELOG diff is a pure ### Added addition — and recommended always()!cancelled(), applied in follow-up commit f591ced. It approved the self-anchoring design and the build-matrix != '' gating as-is.

Follow-up (not in scope for #21)

A multi-shard os-list run (no build-matrix) intentionally gets no comment per the issue's literal scope; keying the gate on computed matrix length instead could be a future enhancement if the table is wanted there too.

Add a `matrix-comment` job to `csharp-ci.yaml` and `scala-ci.yaml`
(`needs: build-and-test`, `if: always()`) that queries the run's
per-shard job outcomes via the GitHub API and upserts a
`shard | result | duration` table via
marocchino/sticky-pull-request-comment under a
`<artifact-prefix>-build-matrix` header, distinct from the coverage
comment. No-ops without `build-matrix`, on non-PR events, and for
dependabot. Rendering is done by a new, unit-tested
`scripts/render_matrix_comment.py`.
…celled()

Restore the `## [2.3.4] - 2026-07-10` release heading and its Fixed
block (#30, #32) that the previous commit accidentally folded under
[Unreleased]; keep only the #21 Added bullet in [Unreleased].

Change the matrix-comment job's `if` from `always()` to `!cancelled()`
in csharp-ci.yaml and scala-ci.yaml so it still runs on shard failure
(fail-fast is false) but does not post a wall of cancelled shards on a
manual run cancellation.
Signed-off-by: monsieurleberre <monsieurleberre@users.noreply.github.com>
@monsieurleberre monsieurleberre merged commit a9b919a into dev Jul 14, 2026
1 check passed
@monsieurleberre monsieurleberre deleted the feat/21-matrix-sticky-comment branch July 14, 2026 06:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

csharp-ci/scala-ci v2: publish the build-matrix results as a sticky PR comment

1 participant