Skip to content

Latest commit

 

History

History
67 lines (58 loc) · 1.77 KB

README.md

File metadata and controls

67 lines (58 loc) · 1.77 KB

Webhook Auto-Pull

The webhook script for automatic pulling from your repo. You can custom your script after pulled by edit configs.json.

Installation & Update

Install script:

Clone this repo and npm install.

git clone https://github.com/l3lackMegas/webhook-auto-pull.git
cd webhook-auto-pull
npm install

Update script:

git pull
npm install

Getting Started

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/"
        }

    }
}

Run Server & Usage

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

Make sure that your webhook has option similar this image. Webhook Add