Hide obsolete Job summaries (#902)

- Injects a `<!-- gradle-job-summary: ${jobCorrelator} -->` marker on
each job summary
- Lists 100 last comments: unfortunately there is no API to specifically
filter for comments, and checking the last 100 comments (the limit) is
usually enough and does not require iterating over pages
- Mutate comments having this expected marker

I tried to add some tests, but I'm not familiar enough to setup a
complete test suite with proper mocking of GitHub/Octokit with jest.

I could potentially extract the `prComment` creation to check for the
marker presence, let me know.

Note: it seems like there is currently an issue on mutating comments as
`OUTDATED` through graphql. Although it does not work as expected
(flagging as OUTDATED) the comments are still minimized, which is what
we want.
- https://github.com/orgs/community/discussions/19865

Implements #176

---------

Co-authored-by: Daz DeBoer <daz@gradle.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Simon Marquis
2026-06-10 10:14:48 -06:00
committed by GitHub
co-authored by Daz DeBoer Claude Opus 4.8
parent a740661292
commit 318eed7038
4 changed files with 124 additions and 4 deletions
+5
View File
@@ -548,6 +548,11 @@ jobs:
- run: ./gradlew build --scan
```
When a comment is added, any earlier Job Summary comments posted by the same job on that Pull Request are
automatically minimized, so only the most recent result remains expanded. This also applies when
`add-job-summary-as-pr-comment: 'on-failure'` is used: once a later run of the job succeeds, the previous
failure comment is collapsed.
Note that to add a Pull Request comment, the workflow must be configured with the `pull-requests: write` permission.