{"id":14975445,"url":"https://github.com/jquery/node-notifier-server","last_synced_at":"2025-10-02T05:31:14.075Z","repository":{"id":65978895,"uuid":"349244068","full_name":"jquery/node-notifier-server","owner":"jquery","description":"Lightweight, minimal, and secure GitHub webhook server with support for shell scripts.","archived":false,"fork":true,"pushed_at":"2023-10-01T01:56:31.000Z","size":98,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-21T11:36:30.439Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"gnarf/node-notifier-server","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jquery.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}},"created_at":"2021-03-18T23:23:44.000Z","updated_at":"2023-07-08T21:03:19.000Z","dependencies_parsed_at":"2023-09-30T23:45:37.318Z","dependency_job_id":null,"html_url":"https://github.com/jquery/node-notifier-server","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/jquery/node-notifier-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fnode-notifier-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fnode-notifier-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fnode-notifier-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fnode-notifier-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jquery","download_url":"https://codeload.github.com/jquery/node-notifier-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jquery%2Fnode-notifier-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277958753,"owners_count":25905774,"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","status":"online","status_checked_at":"2025-10-02T02:00:08.890Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-09-24T13:52:02.770Z","updated_at":"2025-10-02T05:31:13.784Z","avatar_url":"https://github.com/jquery.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://github.com/jquery/node-notifier-server/actions/workflows/CI.yaml/badge.svg)](https://github.com/jquery/node-notifier-server/actions/workflows/CI.yaml)\n[![Tested with QUnit](https://img.shields.io/badge/tested_with-qunit-9c3493.svg)](https://qunitjs.com/)\n\n# node-notifier-server\n\nEach subscriber `.js` file in the `notifier.d/` directory should export a function that takes a notify `notifier` object, and an `exec` callback to call the shell script of the same name should be executed.\n\n## Examples\n\n### foo.js\n\n```javascript\nmodule.exports = function (notifier, exec) {\n  notifier.on('repo-owner/repo-name/push/heads/main', exec);\n};\n```\n\n### foo.sh\n\n```shell\n#!/bin/bash\ncd /var/lib/some-service\ngit fetch origin\necho \"Checking out $1\"\ngit checkout --force \"$1\"\nnpm ci\nnohup /etc/init.d/some-service restart \u0026\n```\n\n## API\n\n## Content type\n\nUse of the `application/json` content type is required.\n\nSupport for the `application/x-www-form-urlencoded` format was removed in node-notifier 4.0.0 as a security hardening measure.\n\n### `WEBHOOK_SECRET` environment variable\n\nWhen operating a public notifier server, it is recommended to only use [secure webhooks](https://docs.github.com/en/developers/webhooks-and-events/webhooks/securing-your-webhooks). To enable these, set the `WEBHOOK_SECRET` environment variable on your server, and configure your source of webhooks (e.g. GitHub.com) to use these to add signatures to delivered events.\n\nWhen the `WEBHOOK_SECRET` environment variable is set, any received events that do not carry a valid signature are ignored.\n\nThe secret can alternatively be configured via a `config.json` file in this directory, shaped as follows:\n\n```json\n{\n  \"webhookSecret\": \"\"\n}\n```\n\n### `notifier.on(eventPath, callback)`\n\nParameters:\n* `eventPath {string}`: Slash-separated string containing 4 segments:\n  - repo owner,\n  - repo name,\n  - webhook event type,\n  - webhook event ref (this may contain additional slashes)\n\n  For example, `jquery/api.jquery.com/push/heads/main` would subscribe to the https://github.com/jquery/api.jquery.com repository, for a \"push\" event, with reference `refs/heads/main`.\n\n  You can use a wildcard within the string to listen for many possible references.\n  This is especially useful when subscribing for tags.\n  For example, `example/test/push/tags/*` would listen for any tags, and `example/test/push/heads/*` would listen for any branches.\n\n* `callback {Function}`\n\n  Called after a matching webhook is received, and passed a `data` parameter.\n\n* `callback.data {Object}`:\n  For all events:\n  - `owner {string}`: repo owner.\n  - `repo {string}`: repo name.\n  - `type {string}`: webhook event type.\n\n  For \"push\" events:\n  - `commit {string}`: The head SHA1 of the pushed commit reference.\n  - `branch {string|undefined}`: The branch name, if a branch was pushed.\n  - `tag {string|undefined}`: The tag name, if a tag was pushed.\n\n### `subscriber(notifier, exec)`\n\nThis is the interface that exported subscriber scripts in the `notifier.d/` directory should follow.\n\nIt is called once, when the server initially starts up.\n\nParameters:\n\n* `notifier {Notifier}`\n\n* `exec {Function}`: This is a preset callback to use with `notifier.on()`, for the common use case of invoking a shell script after a \"push\" event. It will run a shell script by the name of `\u003cbasename\u003e.sh` in the same directory (e.g. `foo.sh` for a `foo.js` subscriber), and pass it one shell argument: `data.commit` (the SHA1 of the pushed reference).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquery%2Fnode-notifier-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjquery%2Fnode-notifier-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjquery%2Fnode-notifier-server/lists"}