Skip to content

Repository files navigation

github-webhook-bridge

An Azure Functions application that receives GitHub Webhooks and forwards them to Discord.

  • Endpoints: POST / (webhook receiver), GET / (health check)
  • Stack: C# / .NET 10 / Azure Functions v4 Isolated / Azure Table + Blob Storage
  • Signature verification: HMAC-SHA256 (x-hub-signature-256, timing-safe comparison)

Setup

Prerequisites

Environment variables

Set these in src/local.settings.json (register them as application settings in the Azure production environment).

KeyRequiredDescription
GITHUB_WEBHOOK_SECRETHMAC-SHA256 signature verification secret
AzureWebJobsStorageAzure Storage connection string (use UseDevelopmentStorage=true locally)
DISCORD_WEBHOOK_URLDefault destination Discord webhook URL (fallback when ?url= is not specified)
DISABLED_EVENTSComma-separated event names to disable; can also be overridden via the ?disabled-events= query parameter
MUTES_FILE_PATHLocal file path for mute rules
MUTES_FILE_URLHTTPS URL for mute rules
MUTES_BLOBAzure Blob URI for mute rules
GITHUB_USER_MAP_FILE_PATHLocal file path for the GitHub→Discord user map
GITHUB_USER_MAP_FILE_URLHTTPS URL for the user map
GITHUB_USER_MAP_BLOBAzure Blob URI for the user map
APPLICATIONINSIGHTS_CONNECTION_STRINGApplication Insights / Azure Monitor connection string

Running locally

dotnet restore
dotnet build
# Run tests
dotnet test -c Release
# Start Azure Functions locally (run from the src/ directory)cd src && func start

Endpoint: http://localhost:7071/

Endpoints

EnvironmentURL
Productionhttps://<functionapp>.azurewebsites.net/
Localhttp://localhost:7071/
  • POST / (webhook receiver): Receives GitHub webhook events and forwards them to Discord.
  • GET / (health check): Returns 200 OK with { "message": "book000/github-webhook-bridge is running" }.

Query parameters

ParameterDescription
urlDestination Discord webhook URL (only URLs starting with https://discord.com/api/webhooks/ or https://discordapp.com/api/webhooks/ are allowed)
disabled-eventsEvent names to disable for this request only (comma-separated)

Supported events

Implemented (12 types)

EventDescription
pingWebhook registration check
pushCode push
pull_requestPull request operations
pull_request_reviewPull request review
pull_request_review_commentReview comment
pull_request_review_threadReview thread resolve/reopen
issuesIssue operations
issue_commentIssue / PR comment
discussionDiscussion
forkFork
publicRepository made public
starStar

Any other event returns HTTP 406.

Mute rules

Notifications can be filtered per user. Rules are defined as a JSON array and specified via one of MUTES_FILE_PATH / MUTES_FILE_URL / MUTES_BLOB (priority order: Blob > URL > local file).

[
{
"userId": 123456789,
"type": "include",
"events": [
{ "eventName": "pull_request", "actions": ["opened", "closed"] }
]
}
]
typeBehavior
includeMute only the events/actions listed in events
excludeMute everything except the events/actions listed in events
allMute all notifications

If actions is omitted, all actions of that event are targeted.

GitHub→Discord user map

Mapping a GitHub user ID (numeric) to a Discord user ID lets notifications generate mentions. Defined as a JSON object and specified via one of GITHUB_USER_MAP_FILE_PATH / GITHUB_USER_MAP_FILE_URL / GITHUB_USER_MAP_BLOB.

{
"1234567": "987654321098765432"
}

License

MIT

About

🌉 Bridge the GitHub webhook to filter the repositories to notify.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages