Skip to content

A webhook filter for Deno that filters GitHub events before forwarding them to a Discord webhook

License

Notifications You must be signed in to change notification settings

shiftinv/github-webhook-filter

Folders and files

NameName
Last commit message
Last commit date
Sep 4, 2022
Dec 28, 2024
Dec 28, 2024
Dec 11, 2024
Sep 6, 2022
Sep 3, 2022
Jul 11, 2024
Dec 28, 2024
Sep 3, 2022
Dec 11, 2024
Dec 11, 2024
Dec 11, 2024
Dec 28, 2024

Repository files navigation

github-webhook-filter

A webhook filter for Deno that filters GitHub events before forwarding them to a Discord webhook, reducing noise.
Additionally, it attempts to handle Discord ratelimits and resend the webhook events if needed, instead of just dropping the requests like GitHub does.

Certain no-op events (which Discord would ignore anyway) and common CI bots are ignored by default; see configuration below for more.

Usage

  1. Host the project somewhere, for example https://deno.com/deploy. Remember to add the environment variables you may want to set, see src/config.ts.
  2. Create a Discord webhook (https://discord.com/api/webhooks/1234/ABCDWXYZ).
  3. Take the ID (1234) and token (ABCDWXYZ) from the URL, and enter https://<filter_url>/1234/ABCDWXYZ (note: no /github) in the GitHub webhook settings:
    settings
  4. Optionally add configuration parameters (see below) to the URL, e.g. ?allowBranches=master,dev&hideTags=1.
  5. ????
  6. Profit!

Configuration

Additional options can be configured per URL:

  • Only forward events from specific branches (allowBranches, simplified wildcard syntax)
    • abc*xyz is equivalent to /^(abc.*xyz)$/
    • stuff,things is equivalent to /^(stuff|things)$/
    • !oh*hi*there is equivalent to /^(oh.*hi.*there)$/ inverted
  • Ignore tag updates (hideTags)
  • Ignore burst PR review comments in a short timespan, only showing the first x comments per review (commentBurstLimit)

About

A webhook filter for Deno that filters GitHub events before forwarding them to a Discord webhook

Topics

Resources

License

Stars

Watchers

Forks