Skip to content

Post the pull request report as a comment on it (#307) - #326

Merged
adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:comment-on-the-pull-request
Aug 24, 2026
Merged

Post the pull request report as a comment on it (#307)#326
adrpo merged 1 commit into
OpenModelica:masterfrom
adrpo:comment-on-the-pull-request

Conversation

@adrpo

@adrpo adrpo commented Aug 24, 2026

Copy link
Copy Markdown
Member

Follows #324, which landed the pull request testing of #307 with the summary only
written to a file and printed in the build log. This posts it.

Rebased on #327, so that one merges first; the commit to review here is the
second one.

--comment

./pr-report.py <N> --comment

posts the summary on pull request <N>, and replaces the comment an earlier
run of the same pull request left rather than adding to a pile - it recognises
its own by a marker in the body:

<!-- openmodelica-library-testing: pull request report -->

It posts as whoever the token belongs to: GITHUB_TOKEN or GH_TOKEN in the
environment, or, failing those, the account gh is
logged in as, which is what makes it usable by hand.

In Jenkins

The pull_request_comment parameter, taking the token from a github-token
credential. The credential is bound where it is used rather than for the stage,
so a job that does not ask for a comment runs whether one is configured or not.

Without a token nothing changes: the report is written and published as before,
the summary is in the build log, and the run says where the file is. With a token
that is refused, the run fails after the report has been written, so the mistake
is visible and a rerun - seconds, it retests nothing - publishes and comments.

Tested

Against a throwaway pull request in a fork,
adrpo/OpenModelicaLibraryTesting#1:

first run posts the summary, as the account gh is logged in as
second run updates that same comment, one comment on the pull request, not two
a token that is refused says so with what GitHub answered, exits 1, report and index still written
no token at all not an error: says where the summary file is and carries on

Generated by Claude Code.

@adrpo
adrpo force-pushed the comment-on-the-pull-request branch from ab5e2a2 to c5be334 Compare August 24, 2026 16:15
The summary a run writes beside its report is meant to be commented on the
pull request, and --comment does that: it looks for the comment an earlier
run of the same pull request left, recognises it by a marker, and replaces
it rather than adding to a pile. It posts as whoever the token belongs to,
GITHUB_TOKEN or GH_TOKEN in the environment or the account gh is logged in
as, which is how it can be run by hand.

In Jenkins it is the pull_request_comment parameter, taking the token from
a github-token credential. The credential is bound where it is used rather
than for the stage, so a job that does not ask for a comment runs whether
one is configured or not; without a token the report is written and
published as before and the summary says where it is.

---
Generated by Claude Code.
@adrpo
adrpo force-pushed the comment-on-the-pull-request branch from c5be334 to 667addb Compare August 24, 2026 16:34
@adrpo
adrpo enabled auto-merge (squash) August 24, 2026 16:43
@adrpo
adrpo merged commit b2f72a9 into OpenModelica:master Aug 24, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant