Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca59403ee8 | ||
|
|
409711cd7b | ||
|
|
ce845a7baf | ||
|
|
6337feeae1 |
@@ -58,4 +58,4 @@ if [ -n "$MANUAL_USER_MAPPINGS" ]; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ./gitea-notification-hub -config /app/config/config.yaml
|
exec ./gitea-notification-hub -config /app/config/config.yaml -debug
|
||||||
|
|||||||
@@ -114,15 +114,20 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
|||||||
|
|
||||||
case "review_requested":
|
case "review_requested":
|
||||||
event.Type = TypePRReviewRequested
|
event.Type = TypePRReviewRequested
|
||||||
// Notify newly requested reviewers (array)
|
if len(event.Reviewers) > 0 {
|
||||||
if len(e.RequestedReviewers) > 0 {
|
for _, u := range event.Reviewers {
|
||||||
for _, reviewer := range e.RequestedReviewers {
|
p.logger.Debug().Str("requested_reviewer", u.GiteaUsername).Msg("review_requested event")
|
||||||
p.logger.Debug().Str("requested_reviewer", reviewer.Login).Msg("review_requested event")
|
|
||||||
usersToNotify = append(usersToNotify, struct {
|
usersToNotify = append(usersToNotify, struct {
|
||||||
user User
|
user User
|
||||||
reason NotificationReason
|
reason NotificationReason
|
||||||
}{giteaUserToUser(reviewer), ReasonReviewer})
|
}{u, ReasonReviewer})
|
||||||
}
|
}
|
||||||
|
} else if e.RequestedReviewer != nil {
|
||||||
|
p.logger.Debug().Str("requested_reviewer", e.RequestedReviewer.Login).Msg("review_requested event")
|
||||||
|
usersToNotify = append(usersToNotify, struct {
|
||||||
|
user User
|
||||||
|
reason NotificationReason
|
||||||
|
}{giteaUserToUser(*e.RequestedReviewer), ReasonReviewer})
|
||||||
} else {
|
} else {
|
||||||
p.logger.Debug().Msg("review_requested event but no RequestedReviewers field")
|
p.logger.Debug().Msg("review_requested event but no RequestedReviewers field")
|
||||||
}
|
}
|
||||||
@@ -170,7 +175,10 @@ 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
|
||||||
|
if e.Action == "review_requested" {
|
||||||
|
p.logger.Debug().Str("actor", event.Actor.GiteaUsername).Msg("skipping actor filter for review_requested (CI automation)")
|
||||||
|
} else {
|
||||||
beforeFilter := len(usersToNotify)
|
beforeFilter := len(usersToNotify)
|
||||||
usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
|
usersToNotify = p.filterOutActor(usersToNotify, event.Actor)
|
||||||
p.logger.Debug().
|
p.logger.Debug().
|
||||||
@@ -178,6 +186,7 @@ func (p *Processor) HandlePullRequest(e *webhook.PullRequestEvent) {
|
|||||||
Int("after_filter", len(usersToNotify)).
|
Int("after_filter", len(usersToNotify)).
|
||||||
Str("actor_filtered", event.Actor.GiteaUsername).
|
Str("actor_filtered", event.Actor.GiteaUsername).
|
||||||
Msg("filtered out actor from notifications")
|
Msg("filtered out actor from notifications")
|
||||||
|
}
|
||||||
|
|
||||||
// Send notifications
|
// Send notifications
|
||||||
p.sendNotifications(ctx, event, usersToNotify)
|
p.sendNotifications(ctx, event, usersToNotify)
|
||||||
|
|||||||
Reference in New Issue
Block a user