hispanic / staticwoman

A fork of Staticman that provides additional functionality.
https://staticman.net
MIT License
7 stars 2 forks source link

Allow for email notifications with GitLab #1

Closed hispanic closed 4 years ago

hispanic commented 4 years ago

The main thrust of these modifications is to enable the sending of email notifications to comment subscribers when the backing git service is GitLab (as opposed to GitHub).

I see that @OlafHaag mentioned this as being an issue in 2019: https://github.com/eduardoboucas/staticman/issues/22#issuecomment-473752430

My understanding of the history of this issue is that when @ntsim added GitLab support to the codebase in 2018, they left the webhook endpoint untouched. This was because, in GitLab, merge requests are set to automatically close the source branch: https://github.com/eduardoboucas/staticman/pull/219

However, it looks like @eduardoboucas added in support for sending email notifications (via webhook) as far back as 2016: https://github.com/eduardoboucas/staticman/issues/42#issuecomment-262938831

Not sure why the miss, but these modifications address it, regardless.

Staticman v3 service-specific webhook endpoints have been added (i.e., /v3/webhook/github and /v3/webhook/gitlab). In the corresponding code, support has been added for webhook request authentication, which may be configured via the JSON config. This amounts to allowing for gitlabWebhookSecret and githubWebhookSecret properties to be set, thereby triggering webhook request authentication for GitHub and/or GitLab. If either secret is configured in Staticman, but missing from the webhook calls (or not valued as expected), an error is thrown.

This also addresses https://github.com/eduardoboucas/staticman/issues/389

Update: The webhook request authentication functionality introduced here is further refined in https://github.com/hispanic/staticwoman/pull/8