Skip to content

Webhook to send notification in slack / discord / other when Github action emits an event

License

Notifications You must be signed in to change notification settings

jboucly/webhook-github-action

Repository files navigation

 __          __  _     _                 _       _____ _ _   _           _                    _   _
 \ \        / / | |   | |               | |     / ____(_) | | |         | |         /\       | | (_)
  \ \  /\  / /__| |__ | |__   ___   ___ | | __ | |  __ _| |_| |__  _   _| |__      /  \   ___| |_ _  ___  _ __  ___
   \ \/  \/ / _ \ '_ \| '_ \ / _ \ / _ \| |/ / | | |_ | | __| '_ \| | | | '_ \    / /\ \ / __| __| |/ _ \| '_ \/ __|
    \  /\  /  __/ |_) | | | | (_) | (_) |   <  | |__| | | |_| | | | |_| | |_) |  / ____ \ (__| |_| | (_) | | | \__ \
     \/  \/ \___|_.__/|_| |_|\___/ \___/|_|\_\  \_____|_|\__|_| |_|\__,_|_.__/  /_/    \_\___|\__|_|\___/|_| |_|___/

slack discord

Description

Webhook to send notification in slack / discord when github action run/completed/failed.

How to use ? ℹ️

An HTTP server runs and listens permanently on certain pre-defined routes (see routes), when an event coming from github is emitted the server receives the information and processes it to send a notification to Slack or to Discord (depending on the road).

Setting up a server

Fork the repository and deploy it on a server such as Heroku, Deta or other.

Setting up a webhook on a github repository

Go to the repository settings webhook section and click on Add webhook :


Once on the interface add the url of the webhook of your server on which this application is located with the correct route for either Discord or Slack (see Routes). Select Content-Type: application/json As well as emit individual events and choose Check runs

Then validate.


Routes

For Slack :

/github-actions/slack

For Discord :

/github-actions/discord

Development 👨‍💻

Installation

$ npm i

Run dev mode

$ npm run start:dev

Run prod mode

$ npm run start