The webhook script for automatic pulling from your repo. You can custom your script after pulled by edit configs.json
.
Clone this repo and npm install
.
git clone https://github.com/l3lackMegas/webhook-auto-pull.git
cd webhook-auto-pull
npm install
git pull
npm install
First, setup config by copy sample-configs.json
to configs.json
.
cp sample-configs.json configs.json
Edit file configs.json
.
{
"key": "123456789", // To verify request
"port": 4545, // Port for run web server
"repo": {
"item-name": { // To select repo from configs
"url": "github.com/User/repo.git", //
"path": "/local/path/to/repo",
"branch": "main",
"user": "git-username",
"token": "token-or-account-password",
"script": "", // Custom script, Run after finish pulling
"webhook": "http://localhost/" // Request with GET method after git pull successfully
},
"item-name-2": {
"url": "github.com/User/repo2.git",
"path": "/local/path/to/repo2",
"branch": "main",
"user": "username",
"token": "token-or-account-password",
"script": "ls -al",
"webhook": "http://localhost/"
}
}
}
Just start script by node main.js
or using npm script.
npm run start
Add webhook and use payload URL like this.
https://www.domain.com/?key=YOUR_KEY_FROM_CONFIG&item=ITEM_NAME_FROM_CONFIG