67P / hubot-incoming-webhook

Accept incoming Webhooks to write messages to a room/channel
9 stars 8 forks source link

[hooks] npm #8

Open raucao opened 6 years ago

raucao commented 6 years ago

Took me a while to actually find out how to configure hooks for npm modules. They only wrote this blog post once (which is probably how I knew that it was possible somehow in the first place):

http://blog.npmjs.org/post/145260155635/introducing-hooks-get-notifications-of-npm

None of that is part of their docs. Setting up hooks is only possible via the API and there's https://www.npmjs.com/package/wombat for doing it from a shell.

raucao commented 5 years ago

I just had a look at this, and it seems like the npm hooks are currently rather broken. Here's the hook I received after publishing hubot-kredits:

https://webhook.site/#!/2e3f839e-3b48-4f20-9257-f204990e3148/ebae3adf-081c-4191-8e02-f8293e4a64ec/1

Note that the event is "package:change" instead of "package:publish", and the actual "change" object is empty. This does not reflect the code found in some of the clients that process npm hooks like e.g. captain-hook. It also doesn't contain enough information to discern between version updates and other package changes.

Even though there's still no real documentation for the hooks themselves, the hook management has since been incorporated to the npm CLI: https://docs.npmjs.com/cli/hook.html (but that man page still links to the introductory blog post). The CLI works as expected. It's just the hook payload that seems incorrect to me.

raucao commented 5 years ago

(Adding a kredits label for my research. Already spent quite some time on this without ever writing a line of code.)