Skip to content

replaceitem/gh-dc-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Available for Docker Available on GitHub Container Registry Supports Deno Chat with me on Discord

Converts GitHub webhooks to nicely formatted Discord webhooks.

What makes this different to Discords built-in GitHub webhooks?

  • Uses nicer formatted messages that is more in line with GitHubs UI style, using Octicons as Discord emojis and GitHubs color scheme.
  • Edits previous Discord messages on updates instead of spamming new ones. (example)

Supported events

Supported events compared to Discords GitHub compatible webhook endpoint
Event Supported by Discord Supported
branch_protection_configuration ❌ ❌
branch_protection_rule ❌ ❌
check_run ✅ ❌
check_suite ✅ ❌
code_scanning_alert ❌ ❌
commit_comment âś… âś…
create âś… âś…
custom_property ❌ ❌
custom_property_values ❌ ❌
delete ✅ ❌
dependabot_alert ❌ ❌
deploy_key ❌ ❌
deployment ❌ ❌
deployment_protection_rule ❌ ❌
deployment_review ❌ ❌
deployment_status ❌ ❌
discussion âś… âś…
discussion_comment âś… âś…
fork âś… âś…
github_app_authorization ❌ ❌
gollum ❌ ❌
installation ❌ ❌
installation_repositories ❌ ❌
installation_target ❌ ❌
issue_comment âś… âś…
issues âś… âś…
label ❌ ❌
marketplace_purchase ❌ ❌
member ✅ ❌
membership ❌ ❌
merge_group ❌ ❌
meta ❌ ❌
milestone ❌ ❌
org_block ❌ ❌
organization ❌ ❌
package ❌ ❌
page_build ❌ ❌
personal_access_token_request ❌ ❌
ping ❌ ❌
project_card ❌ ❌
project ❌ ❌
project_column ❌ ❌
projects_v2 ❌ ❌
projects_v2_item ❌ ❌
projects_v2_status_update ❌ ❌
public âś… âś…
pull_request âś… âś…
pull_request_review_comment ✅ ❌
pull_request_review âś… âś…
pull_request_review_thread ❌ ❌
push âś… âś…
registry_package ❌ ❌
release âś… âś…
repository_advisory ❌ ❌
repository ❌ ❌
repository_dispatch ❌ ❌
repository_import ❌ ❌
repository_ruleset ❌ ❌
repository_vulnerability_alert ❌ ❌
secret_scanning_alert ❌ ❌
secret_scanning_alert_location ❌ ❌
secret_scanning_scan ❌ ❌
security_advisory ❌ ❌
security_and_analysis ❌ ❌
sponsorship ❌ ❌
star ❌ ✅
status ❌ ❌
sub_issues ❌ ❌
team_add ❌ ❌
team ❌ ❌
watch ✅ ❌
workflow_dispatch ❌ ❌
workflow_job âś… âś…
workflow_run âś… âś…

star

New star added Star removed

fork

Fork created

public

Repository published

push

Pushed 1 commit to test/main Pushed 10 commits to test/main img.png

create

Branch feature-1 created Tag v1.2.34 created

release

Release v1.0.0 published Pre-release v1.1.0-beta.1 published

workflow_job and workflow_run

Workflow run with several jobs Workflow run with several different conclusions

commit_comment

New comment on commit 3f4ea57

discussion

Discussion #10 created Discussion #10 answered Discussion #12 closed as duplicate Discussion #12 closed as outdated Discussion #12 closed as resolved Discussion #12 reopened

discussion_comment

New comment on discussion #10

issues

Issue opened Issue closed Issue closed as duplicate Issue reopened

issue_comment

New comment on issue #2 New comment on pull request #6

pull_request

Pull request opened Draft pull request opened Pull request merged Pull request converted to draft Pull request marked as ready for review

pull_request_review

Approved these changes Requested changes Reviewed

Usage

All you need to do to use this yourself is to host the docker image.

Either start a container with a docker command:

docker run -d -p 3000:3000 ghcr.io/replaceitem/gh-dc-hook:latest

or use docker-compose.yml:

services:
  backend:
    image: "ghcr.io/replaceitem/gh-dc-hook:latest"
    ports:
      - "3000:3000"

The used emojis are from a private Discord server, but they will work with webhooks across Discord, without having access to the Discord server or creating the emojis yourself.

Deployment

Docker images are provided through the GitHub container registry. They don't need any configuration through environment variables. You only need to map the exposed port 3000 to a host port.

Webhook setup

Set up a discord webhook as usual and copy the webhook URL. It will look like this:

https://discord.com/api/webhooks/1234567890987654321/s0Me-s3CReT_t0k3n-y0U-Sh0uLd_n3v3R-r3Ve4L_uNd3R-4nY_c1RCuM5t4NC3s

Usually when setting this up with discord, you would need to append /github to let Discord convert the GitHub webhook payload to the discord message content format.

To let gh-dc-hook handle the payload, you need to replace the discord.com part of the URL with the domain where you deployed it:

https://example.org/api/webhooks/1234567890987654321/s0Me-s3CReT_t0k3n-y0U-Sh0uLd_n3v3R-r3Ve4L_uNd3R-4nY_c1RCuM5t4NC3s

This will send the event to gh-dc-hook instead, which will convert the payload to a Discord message first. It will then be sent to the Discord API with the same Webhook ID and token.

Development

Helpful resources

About

Webhook converter from GitHub webhooks to nicely formatted Discord messages

Topics

Resources

Stars

Watchers

Forks

Packages