Pull Requests

Push scopes and other per-pull-request data to Mergify.


Set the scopes for a pull request #

PUT /repos/{owner}/{repository}/pulls/{number}/scopes

Set the scopes for a pull request. This addresses the scopes by pull request number alone, so the report cannot say which revision it was computed for, and the last one to arrive wins whatever head that was. Prefer `PUT /repos/{owner}/{repository}/commits/{sha}/scopes`, which names the revision.

CI Application Key
number integer required

The pull request number

min: 0 · max: 9223372036854776000

owner string required

The owner of the repository

min length: 1 · max length: 40 · pattern: ^[a-zA-Z0-9\-]+$

repository string required

The name of the repository

min length: 1 · max length: 100 · pattern: ^[\w\-\.]+$

scopesstring[]required
all_scopesboolean
204 Successful Response
403 Forbidden
404 Not found
409 Conflict
422 Unprocessable entity
Example Request
curl -X PUT "https://api.mergify.com/v1/repos/:owner/:repository/pulls/:number/scopes" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "scopes": [
    "string"
  ],
  "all_scopes": false
}'

Set the scopes for a pull request (deprecated, use PUT) #

POST /repos/{owner}/{repository}/pulls/{number}/scopes
Deprecated

Deprecated: use PUT on `/repos/{owner}/{repository}/commits/{sha}/scopes` instead.

CI Application Key
number integer required

The pull request number

min: 0 · max: 9223372036854776000

owner string required

The owner of the repository

min length: 1 · max length: 40 · pattern: ^[a-zA-Z0-9\-]+$

repository string required

The name of the repository

min length: 1 · max length: 100 · pattern: ^[\w\-\.]+$

scopesstring[]required
all_scopesboolean
204 Successful Response
403 Forbidden
404 Not found
409 Conflict
422 Unprocessable entity
Example Request
curl -X POST "https://api.mergify.com/v1/repos/:owner/:repository/pulls/:number/scopes" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "scopes": [
    "string"
  ],
  "all_scopes": false
}'

Set the scopes for a commit #

PUT /repos/{owner}/{repository}/commits/{sha}/scopes

Set the scopes a commit impacts. Prefer this over the pull request variant. Scopes computed for one revision do not describe another, so naming the revision lets a report be matched against the head a pull request actually has. A report for a revision a pull request has already moved past can no longer overwrite what its current head reported; a report *is* still applied to every **open** pull request whose head it currently is, which is the normal case. A report replaces the previous one for that revision in full: `all_scopes` defaults to `false`, so omitting it clears a barrier previously reported for the same commit. Send the complete result of your scope computation every time. Send the pull request's head SHA (`github.event.pull_request.head.sha`). That is not always the revision your job checked out: on a `pull_request` event the default checkout is a merge commit, and a report keyed on that SHA matches no pull request head.

CI Application Key
sha string required

The commit SHA the scopes were computed from

pattern: ^[0-9a-fA-F]{40}$

owner string required

The owner of the repository

min length: 1 · max length: 40 · pattern: ^[a-zA-Z0-9\-]+$

repository string required

The name of the repository

min length: 1 · max length: 100 · pattern: ^[\w\-\.]+$

scopesstring[]required
all_scopesboolean
204 Successful Response
403 Forbidden
404 Not found
409 Conflict
422 Unprocessable entity
Example Request
curl -X PUT "https://api.mergify.com/v1/repos/:owner/:repository/commits/:sha/scopes" \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
  "scopes": [
    "string"
  ],
  "all_scopes": false
}'

Was this page helpful?