{"id":15090909,"url":"https://github.com/vmarchaud/pm2-githook","last_synced_at":"2025-10-06T08:31:41.466Z","repository":{"id":41300856,"uuid":"70625486","full_name":"vmarchaud/pm2-githook","owner":"vmarchaud","description":"receive webhook from github/gitlab and ask pm2 to reload the application for you","archived":true,"fork":false,"pushed_at":"2023-05-17T12:03:20.000Z","size":124,"stargazers_count":42,"open_issues_count":9,"forks_count":20,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-01T11:07:05.286Z","etag":null,"topics":["bitbucket","devops","github","gitlab","jenkins","module","pm2","webhook"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vmarchaud.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-11T18:53:44.000Z","updated_at":"2024-05-22T13:22:50.000Z","dependencies_parsed_at":"2024-12-01T15:33:27.131Z","dependency_job_id":"38d45755-aa1e-4298-884f-7b07e1251af7","html_url":"https://github.com/vmarchaud/pm2-githook","commit_stats":{"total_commits":46,"total_committers":9,"mean_commits":5.111111111111111,"dds":0.6304347826086957,"last_synced_commit":"f24ce9e02356f0c78282c17a53bda91bec287112"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarchaud%2Fpm2-githook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarchaud%2Fpm2-githook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarchaud%2Fpm2-githook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vmarchaud%2Fpm2-githook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vmarchaud","download_url":"https://codeload.github.com/vmarchaud/pm2-githook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235515424,"owners_count":19002481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitbucket","devops","github","gitlab","jenkins","module","pm2","webhook"],"created_at":"2024-09-25T10:34:39.887Z","updated_at":"2025-10-06T08:31:36.127Z","avatar_url":"https://github.com/vmarchaud.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## [Depreciation notice]\n\nThis module is not maintained anymore as i stopped using PM2 a long time ago, feel free to fork it to continue using it, fix your bugs or dev your features !\n\n## Description\n\nPM2 module to receive http webhook from github, execute pre/post hook and gracefull reload the application using pm2.\n\n## Install\n\n`pm2 install pm2-githook`\n\n## Configure\n\n- `port` (Defaults to `8888`) : The port that will be used by the http server to receive hooks.\n- `apps` : Contains definition of applications in JSON :\n\n    ```json\n      {\n        \"APP_NAME\" : {\n          \"secret\" : \"supersecret\",\n          \"prehook\" : \"npm install --production \u0026\u0026 git submodule update --init\",\n          \"posthook\" : \"echo done\",\n          \"errorhook\" : \"echo error\",\n          \"service\": \"github\"\n        }\n      }\n    ```\n\n    - `APP_NAME` is the name of the api **in pm2** and in the **url** defined on github or gitlab (eg: : `http://127.0.0.1:8888/APP_NAME`).\n    - `secret` is the secret you put in github/gitlab to verify that the transaction is made by github/gitlab.\n    - `prehook` is the shell command executed in the `cwd` **(care of this)** of the app after the `pull` and before the `gracefullReload`.\n    - `posthook` is the shell command executed in the `cwd` **(care of this)** of the app after making the `gracefullReload`.\n    - `errorhook` is the shell command executed in the `cwd` **(care of this)** of the app if an error occurs.\n    - `service` is the service used to make the http call (`github` is the default)\n      - `github` : you'll need to set the same secret as defined in github (can specify branch)\n      - `gogs` : (applies to forks such as gitea) you'll need to set the same secret as defined in gogs (can specify branch)\n      - `gitlab` : you'll need to set the secret as the token defined in gitlab\n      - `jenkins` : you'll need to set the secret as the ip of the jenkins (can specify branch)\n      - `bitbucket` : secret not needed, bitbucket ip range is inside the code (can specify branch)\n      - `droneci` : you'll need to set the secret to match the `Authorization` header defined inside the [plugin](http://addons.drone.io/webhook/) (can specify branch)\n    - `nopm2` if set to true, we will not reload the application using pm2 (default to `false`)\n    - `cwd` if provided we don't resolve the cwd using pm2 and will take this value (defaults to `undefined`)\n\n`(can specify branch)`  mean that you can use a addional configuration to run the posthook on a specific branch\n\n#### How to set these values ?\n\n After having installed the module you have to type :\n`pm2 set pm2-githook:key value`\n\nTo set the `apps` option and since its a json string, i advice you to escape it to be sure that the string is correctly set ([using this kind of tool](http://bernhardhaeussner.de/odd/json-escape/)).\n\ne.g:\n- `pm2 set pm2-githook:port 8080` (bind the http server port to 8080)\n- `pm2 set pm2-githook:apps \"{\\\"APP_NAME\\\":{\\\"secret\\\":\\\"supersecret\\\",\\\"prehook\\\":\\\"npm install --production \u0026\u0026 git submodule update --init\\\",\\\"posthook\\\":\\\"echo done\\\",\\\"errorhook\\\":\\\"echo error\\\"}}\"`\n\n## Uninstall\n\n`pm2 uninstall pm2-githook`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmarchaud%2Fpm2-githook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvmarchaud%2Fpm2-githook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvmarchaud%2Fpm2-githook/lists"}