Skip to content

Repository Webhook

Definition of a Webhook on repository level, the following properties are supported:

Key Value Description Notes
url string The payload url to which a POST request will be sent when the webhook gets triggered
active boolean If the webhook is active
aliases list[string] List of webhook alias urls, can be used to change the url of a webhook without re-creating the webhook as a whole read-only property
content_type string The content type the webhook shall use json or form
events list[string] List of events that trigger the webhook supported events
insecure_ssl string If the webhook uses insecure ssl connections 0 or 1
secret string or null The secret the webhook shall use if any

The secret value can be resolved via a credential provider. The supported format is <credential_provider>:<provider specific data>.

  • Bitwarden: bitwarden:<bitwarden item id>@<custom_field_key>

    "secret": "bitwarden:118276ad-158c-4720-b68d-af8c00fe3481@webhook_secret"
    
  • Pass: pass:<path/to/secret>

    "secret": "pass:path/to/org/webhook_secret"
    

Note

After executing an import operation, the secret will be set to ******** as GitHub will only send redacted secrets. You will need to update the configuration with the real secret value, either by entering the secret value (not advised), or referencing it via a credential provider.

Webhooks which have a redacted secret defined will be skipped during processing.

Jsonnet Function

orgs.newRepoWebhook('<url>') {
  <key>: <value>
}

Validation rules

  • redacted secrets (********) trigger a validation info and will skip the webhook during processing
  • content_type must either be json or form
  • insecure_ssl must either be 0 (disabled) or 1 (enabled)

Example usage

orgs.newOrg('adoptium') {
  ...
  _repositories+:: [
    ...
    orgs.newRepo('aqa-tests') {
      ...
      webhooks+: [
        orgs.newRepoWebhook('https://ci.adoptium.net/ghprbhook/') {
          events+: [
            "issue_comment",
            "pull_request"
          ],
          secret: "pass:path/to/webhook/secret",
        },
      ],
    }
  ]
}