Skip to content

AvionBlock/github-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github-webhook

A lightweight GitHub webhook listener used internally by our team. It listens for push events on specific branches and triggers server restarts via the Pterodactyl API.

🛠 Setup

1. Clone and install

git clone https://github.com/AvionBlock/github-webhook.git
cd github-webhook
yarn install

2. Environment variables

Copy the example file and fill in your values:

cp .env.example .env

See .env.example for descriptions of all required variables.

3. GitHub webhook config

  • Payload URL: https://example.com/webhook
  • Content type: application/json
  • Secret: Same as GITHUB_SECRET in .env
  • Events: Only enable push

4. Start the server

yarn start

For development with watch mode:

yarn dev

🔧 Branch configuration

Branch handlers are defined in branchConfig.ts like so:

export const branchHandlers = {
  main: async () => {
    return restartServer(process.env.PROD_SERVER_ID);
  },
  dev: async () => {
    return restartServer(process.env.DEV_SERVER_ID);
  },
};

You can customize this file to trigger different actions per branch.

🔐 Notes

  • Signature verification is enforced using x-hub-signature-256
  • The webhook should be served over HTTPS in production

About

A simple GitHub webhook listener for our internal projects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published