Skip to main content
Version: 1.0

GitHubWebhook

GitHubWebhook defines a webhook which can be triggered by GitHub webhook events. This is useful for integrating Pullup into your GitHub repositories.

Model#

spec.triggers#

Required

See HTTPWebhook for more details.

spec.action#

See HTTPWebhook for more details.

spec.repositories#

Required

The repositories to handle. This value is an array of objects which contains the following fields.

  • name Required - Full name of a repository. (e.g. tommy351/pullup)
  • push
  • pullRequest

You have to specify one of push or pullRequest field to activate the webhook.

Event Filter#

Event filter is an object containing the following fields.

  • include - List of conditions to include.
  • exclude - List of conditions to exclude.

You can use a string or a regular expression in these fields.

- master
- /.*/

push#

Handle push events.

KeyTypeDescription
branchesEventFilterFilter events by branches.
tagsEventFilterFilter events by tags.

pullRequest#

Handle pull_request events.

KeyTypeDescription
branchesEventFilterFilter events by pull request base branches.
tagsEventFilterFilter events by pull request labels.
types[]stringPull request events to handle. Available values are assigned, unassigned, labeled, unlabeled, opened, edited, closed, reopened, synchronize, ready_for_review, locked, unlocked, review_requested, review_request_removed. Default to ["opened", "synchronize", "reopened", "closed"].

Setup#

Creating Webhooks on GitHub#

See GitHub docs for more details.

  • Payload URL: http://your-site.com/webhooks/github
  • Content Type: Choose application/json
  • Secret: See Securing Webhooks below.

Securing Webhooks#

It is recommended to set a secret on your webhook in order to make sure the payload is sent from GitHub. Set GITHUB_SECRET environment variable on the pullup-webhook deployment to enable this feature.

env:
- name: GITHUB_SECRET
valueFrom:
secretKeyRef:
key: github-secret
name: pullup

Examples#

Only GitHubWebhook specific examples are provided below. See HTTPWebhook for more examples.

Basic#

The following webhook only handles push events. Change push to pullRequest to handle pull request events instead. Noted that you can use both of them at the same time.

apiVersion: pullup.dev/v1beta1
kind: GitHubWebhook
metadata:
name: example
spec:
repositories:
- name: foo/bar
push: {}
triggers:
- name: foobar

Filter by Branch#

apiVersion: pullup.dev/v1beta1
kind: GitHubWebhook
metadata:
name: example
spec:
repositories:
- name: foo/bar
push:
branches:
include:
- master
- /release-.+/
exclude:
- canary
triggers:
- name: foobar