What is Webhook Github Actions ?
Webhook Github Action is a self-hosted express server allowing the sending of notification (webhook) to several messaging systems. Example, you work in a team and you would like to be informed when a CI/CD fails to intervene quickly on the problem encountered by the CI/CD. Webhook Github Action fills this need !
How it works ?
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).
- Version : 1.0.4
- Author : Jboucly
- Created : 31 August, 2022
- Update : 30 November, 2022
Installation
To implement your own webhook server you will need :
- Fork this project in your Github account : https://github.com/jboucly/webhook-github-action
-
Once the project fork is on your repositories, you can push it to a server such as
Heroku or
Deta (free).
-
Heroku
- Create new app in your Heroku account
- Select NodeJS Buildpack
- Set environments variables (see environments variables)
- Deploy app ! (see Deploying with Git )
-
Deta
- Install Deta CLI
- Create new micro
- Set Deta environments variables (see environments variables)
- Deploy in Deta micro ! (see Doc )
-
Heroku
Environments variables
-
NODE_ENV
: environments of your app.
Available :production
,development
WEBHOOK_URL
: Url of your webhook example bot DiscordWEBHOOK_SECRET
: Secret for access in your webhook endpointDISCORD_ICON_URL
: Url for add your icon in Discord notificationDOC_IS_ACTIVE
: Active documentation route (route of doc is : /)
Github Configurations
Once your server is ready to receive notifications from Github, you can set up github webhooks.
Github webhooks are totally free and that's a pleasure 🚀
Go to the settings of the repository on which you want to add notifications when your CI/CD evolves. And click on `Add webhook` :
![](images/add-webhook.png)
- 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
application/json
for send JSON to server. - Add your secret for access to endpoint of server.
- Select individual events and select Check runs than validate.
![](images/add-webhook.png)
Routes
It's possible to send notification to Slack or Discord, and to send the notification from github either to Slack or to Discord there are precisely two routes available :
-
/github-actions/slack
➡️ Send notification for Slack (example of url :https://webhook.jboucly.fr/github-actions/slack
) -
/github-actions/discord
➡️ Send notification for Discord (example of url :https://webhook.jboucly.fr/github-actions/discord
)
Support
If this documentation doesn't answer your questions, So, Please send us Email
We are located in UTC+1 time zone and we answer all questions within 12-24 hours in weekdays. In some rare cases the waiting time can be to 48 hours. (except holiday seasons which might take longer).
Don’t forget to Rate this project on Github repository
Developments
Required : Node installedInstall project :
$ npm i
Run development mode :
$ npm run start:dev
Run production mode :
$ npm run start
Changelog
See what's new added, changed, fixed, improved or updated in the latest versions.
To follow the new updates, follow me on Github @jboucly. Or propose a new feature on issue .
Version 1.0.4 (2 Agu, 2023)
- UpdateUpdate Deta config for deploy project
- UpdateListen port on dev or production
Version 1.0.3 (1 Dec, 2022)
-
AddedAdded condition with environment
variable (
DOC_IS_ACTIVE
)for enabled home route/
. - AddedAdded nodemon config file.
-
AddedAdded
ejs
package to render HTML file with express - UpdateUpdate home route for show documentation of this project.
-
UpdateUpdate
.env.example
file to add new variable and comment
Version 1.0.2 (24 Nov, 2022)
- Updated Update Deta config
- Added Added security on webhooks routes to prevent intrusions
Version 1.0.1 (23 Nov, 2022)
- Fixed Remove vercel
- Fixed Some minor bugs for responsive
- Updated Replace http server for express
- Added Add Deta config file for deployment
- Added Create routes file for define express routes
Version 1.0.0 (22 Nov, 2022)
Initial Release