Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't filter webhooks of Pull Requests #13657

Closed
lhemala opened this issue Nov 20, 2020 · 3 comments
Closed

Can't filter webhooks of Pull Requests #13657

lhemala opened this issue Nov 20, 2020 · 3 comments
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@lhemala
Copy link

lhemala commented Nov 20, 2020

  • Gitea version (or commit ref): 12.3

Description

Hi,
I noticed that getPayloadBranch doesn't work/returns an empty string when the api.Payloader is of type *api.PullRequestPayload.
Because of that I can't filter pull request related notifications (open/edit/reject/approve/merge) and send them to different channel in our slack

I fixed that issue in the following commit by using the head branch as relevant branch for the filter
lhemala@d78e63a

Before I open a PR I wanted to know if this functionality was left out intentionally, maybe because a PR has two branches to which the filter can be applied to (head and base) and therefore the filter might be ambiguous.

In my implementation I only filter for the head branch. If we'd want to filter for both the change would get bigger since the filtering logic only expects a single branch. (But still very much doable)

Relates to:
Enhancements of webhooks (#3998)
WebHooks: branch filter for push/pull request notifications (#2025)

@6543
Copy link
Member

6543 commented Nov 24, 2020

you can not filter webhook in UI, API, ?!?

@lhemala
Copy link
Author

lhemala commented Nov 25, 2020

not for webhooks origination from actions on a pull request (PR open/PR edit/PR reject/PR approve) as I wrote above

@lhemala
Copy link
Author

lhemala commented Nov 25, 2020

Let me elaborate the use case:
We have a monorepo which includes, among other things, our front and backend. In our Slack we have two separate channel on which the respective devs always keep an eye on.
We set up two Slack webhooks in Gitea (via the GUI). One has fe/** as filter, the other be/**, which matches the names of our branches and PRs.

Without the patch, both webhooks fire for any newly opened/edited/approved/rejected PR. With the fix I propose this is not the case and our devs only find the messages they are interested in their respective channel.

@6543 6543 added the type/proposal The new feature has not been accepted yet but needs to be discussed first. label Nov 26, 2020
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

3 participants