fix: don't filter actor for review_requested to allow CI self-request (fixes PR 185)

This commit is contained in:
2026-09-03 13:15:17 +00:00
parent ce845a7baf
commit 409711cd7b
+14 -10
View File
@@ -175,14 +175,18 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
} }
} }
// Remove the actor from notifications (don't notify yourself) // Remove the actor from notifications (don't notify yourself) - but SKIP for review_requested because CI automation may request as same user
beforeFilter := len(usersToNotify) if e.Action == "review_requested" {
usersToNotify = p.filterOutActor(usersToNotify, event.Actor) p.logger.Debug().Str("actor", event.Actor.GiteaUsername).Msg("skipping actor filter for review_requested (CI automation)")
p.logger.Debug(). } else {
Int("before_filter", beforeFilter). beforeFilter := len(usersToNotify)
Int("after_filter", len(usersToNotify)). usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
Str("actor_filtered", event.Actor.GiteaUsername). p.logger.Debug().
Msg("filtered out actor from notifications") Int("before_filter", beforeFilter).
Int("after_filter", len(usersToNotify)).
Str("actor_filtered", event.Actor.GiteaUsername).
Msg("filtered out actor from notifications")
}
// Send notifications // Send notifications
p.sendNotifications(ctx, event, usersToNotify) p.sendNotifications(ctx, event, usersToNotify)
@@ -402,10 +406,10 @@ func (p *Processor) sendNotifications(ctx context.Context, event *Event, users [
// filterOutActor removes the event actor from the notification list // filterOutActor removes the event actor from the notification list
func (p *Processor) filterOutActor(users []struct { func (p *Processor) filterOutActor(users []struct {
user User user User
reason NotificationReason reason NotificationReasol
}, actor User) []struct { }, actor User) []struct {
user User user User
reason NotificationReason reason NotificationReasol
} { } {
var filtered []struct { var filtered []struct {
user User user User