mattermost-plugin-github icon indicating copy to clipboard operation
mattermost-plugin-github copied to clipboard

Filter by branch name

Open doc-sheet opened this issue 3 years ago • 5 comments

Hello.

Is it possible to get notifications on specific branch only?

I tried to subscribe to pushes in master/devel branches and ignore other (usually WIP) pushes.

doc-sheet avatar Nov 02 '22 17:11 doc-sheet

Hello @hanzei, I am interested in this issue, may I take this up?

thoratvinod avatar May 13 '23 11:05 thoratvinod

Sure, thanks for taking a look @thoratvinod :+1:

hanzei avatar May 16 '23 21:05 hanzei

Hi @hanzei ,

I have a question regarding the code. I've read through the codebase, and I noticed that when we run the command /github subscriptions add <repo>, it executes the handleSubscribesAdd method. However, I couldn't find the part in the code where we actually subscribe to the events. In the handleSubscribesAdd method, it seems like we are only adding subscriptions to the database as key-value pairs. Could you please let me know which file contains the code for subscribing to those events?

thoratvinod avatar Jun 02 '23 14:06 thoratvinod

Hi @hanzei,

Thanks for reaching out. Plugin.handleSubscribesAdd calls Plugin.Subscribe. That methods saves to subscriptions to the KV sore. The Plugin.handleWebhook method, which is called when a webhook event from GH comes in, the fetches the list of subscriptions from the store in e.g. https://github.com/mattermost/mattermost-plugin-github/blob/cbad10e07638725b3028dc2225561a91ba3136c9/server/plugin/webhook.go#L732-L735.

Please let me know if that helps.

hanzei avatar Jun 05 '23 07:06 hanzei