GitHub Webhooks¶
Note
This is an Experimental API and can change at any time.
This API provides an endpoint that works with GitHub to provide add-on validation as a GitHub webhook. This end point is designed to be called specifically from GitHub and will only send API responses back to api.github.com.
To set this up on a GitHub repository you will need to:
- Go to Settings > Webhooks & Services
- Add a new Webhook with Payload URL of https://addons.mozilla.org/api/v3/github/validate/
- Click Send me everything
- Click Update webhook
At this point the validator will be able to get the data, but won’t be able to write a response to GitHub. To enable responses to GitHub:
- Go to Settings > Collaborators
- Enter addons-robot and select the entry
- Click Add collaborator
- You will have to wait for a Mozilla person to respond to the invite
If this service proves useful and this service transitions from its Experimental API state, we will remove as many of these steps as possible.
The validator will run when you create or alter a pull request.
-
POST
/api/v3/github/validate/
¶ Request:
A GitHub API webhook body. Currently only pull_request events are processed, all others are ignored.
Response:
Status Codes: - 201 Created – request has been processed and a pending message sent back to GitHub.
- 200 OK – request is not a pull_request, it’s been accepted.
- 422 Unprocessable Entity – body is invalid.