1 Webhook
Robin edited this page 2026-11-22 03:25:09 +01:00

Webhook

Without a webhook, the plugin reads the forge on its own: the list of repositories every hour and each project at least once a day (see Settings). That is enough.

A webhook makes it instant: the forge tells the site when a release is published, a repository created or the main branch changed, and the project is read again within a minute.

Turn it on

  1. Pluginception → Sources, Edit the source, Generate a secret.
  2. The window shows the webhook's Address and its Secret. Copy both: the secret is shown once. To see one again, generate a new one (the previous stops working).
  3. On the forge, add a webhook with:
    • Target URL: the address, e.g. https://www.example.com/wp-json/lrob-pluginception/v1/webhook/git-example-com-acme;
    • Content type: application/json;
    • Secret: the secret;
    • Events: Release, Repository and Push (on GitHub: Releases, Repositories, Pushes).
  4. The forge's test delivery (ping) is answered with 200.

Turn the webhook off in the same window deletes the secret: the address then answers 404.

On the organisation, or on each repository

Both work with the same address and secret:

  • One webhook on the organisation covers all its repositories, present and future. On Forgejo and Gitea: the organisation's Settings → Webhooks; on GitHub: the organisation's Settings → Webhooks. You need to own the organisation.
  • One webhook per repository, in each repository's Settings → Webhooks, if you cannot add one to the organisation, or for an account (accounts have no webhook of their own). A repository created later needs its own.

For a single-repository source, the webhook goes on that repository.

What each event does

Event Effect
Release published, edited or deleted that project is read again
Push to the default branch that project is read again (README, header, image)
Push to another branch ignored
Repository created, renamed, deleted the list of repositories is read again
ping answered, nothing read

The webhook's content is not trusted: it only names a repository, and everything is read back from the forge's API. A repository of another owner is ignored.

Security

  • A webhook is accepted only with a valid HMAC-SHA256 signature of its body, made with the secret (X-Hub-Signature-256, X-Forgejo-Signature or X-Gitea-Signature). Without it: 401, noted in the log.
  • A body over 1 MB is refused (413).
  • The secret is stored in the site's database, never shown again, never logged.

Answers

Code Meaning
202 accepted, a reading is queued
200 ping, or an event that changes nothing shown
401 missing or wrong signature
404 unknown source, or webhook turned off
413 body too large

Each accepted webhook is in the log, origin Webhook.