Review a pull request
Starts a review of a pull or merge request, as if a repository member commented @hacktronai review on it. The review runs on the head commit and posts on the pull request as your PR review settings say: posts_comments and posts_check_status report what it will post. You need the member role or above.
When the head commit already has a review, Hacktron returns that one instead of starting another, with status set to in_progress or already_reviewed.
- A closed or merged pull request returns
409 Conflict. - A review that can’t run returns
422 Unprocessable Entity, with the reason inmessage. You can retry a failed start.
Follow the review with GET /scans/{id}/status, using scan_id.
Request
POST /pull-requests/review
Send an API key with the write scope in the X-Api-Key header.
Body
A required application/json body.
| Field | Description |
|---|---|
pr_urlstring, required | The pull or merge request’s web link. |
Responses
200 OK
| Field | Description |
|---|---|
statusstring, required | started, or in_progress / already_reviewed when a review of the head commit already exists. One of started, in_progress, or already_reviewed. |
scan_idstring (uuid), required, nullable | Scan id, for the scans routes. |
task_idstring, required | |
repositorystring, required | |
numbernumber, required | |
urlstring, required | |
posts_commentsboolean, required | Whether findings are posted as comments on the pull request (the organisation’s scm_comments_enabled). |
posts_check_statusboolean, required | Whether the review shows as a check or status on the pull request (scm_check_statuses_enabled). |
400 Bad Request
Not a pull request link, a repository not enabled for Hacktron, or a GitHub repository connected with a personal access token.
404 Not Found
The pull request, or its repository in the organization, wasn’t found.
409 Conflict
The pull request is closed or merged.
422 Unprocessable Entity
The review could not run; the message says why. A failed start can be retried.
503 Service Unavailable
The repository’s provider could not be read; try again later.