How to have jenkins add a review to a pull request I have a Jenkins instance, with credentials for a &quot;robot&quot; github account, which we use to interact with the GitHub API as a team. Typically, jobs are defined as declarative pipelines. I am looking for the correct syntax to perform the following steps:

At the start of the run, create a review
At the end of each stage, post a review comment, with the status of the stage, e.g. &quot;build passed&quot;.
If all of the stages pass, approve the pull request.

I can allow scripted steps, but the pipeline as a whole should be declarative. No shared libraries, and preferably only using commonly-used plugins.
(update with what I have tried)
I have tried using the pipeline github plugin's review method:
pullRequest.review('APPROVE')

naively, but this throws errors.
What would be the correct syntax here?
I guess the simplest and direct solution would be to use GitHub API: https://docs.github.com/en/rest/reference/pulls#create-a-review-for-a-pull-request
But for the requirement you have, PR checks is usually the way to go and you have a plugin that does the API communication for you: https://www.jenkins.io/doc/pipeline/steps/pipeline-githubnotify-step/