Watch
0
0
Fork
You've already forked hyperhive
0

let notification flows start from submitted pull request reviews

This commit is contained in:
atlas 2026-10-25 16:16:07 +01:00 • committed by mara
commit dd2f0d3ece
7 changed files with 142 additions and 11 deletions

View file

@ -1780,12 +1780,19 @@ fn hook_registration(kind: DeliveryKind) -> (&'static [&'static str], HookScope<
// classifier's account access can request its review.
DeliveryKind::ReviewRequest => (&["pull_request_review_request"], HookScope::Instance),
// Instance-wide, for the notification router, which reads the assign
// events and a push to a PR's branch. They are named: Forgejo's web
// events, a push to a PR's branch and submitted reviews. They are named: Forgejo's web
// form shows each as a box of its own, so a hook edited there can drop
// one while keeping `issues` or `pull_request`.
DeliveryKind::Issues => (&["issues", "issue_assign"], HookScope::Instance),
DeliveryKind::PullRequest => (
&["pull_request", "pull_request_assign", "pull_request_sync"],
&[
"pull_request",
"pull_request_assign",
"pull_request_sync",
"pull_request_review_approved",
"pull_request_review_rejected",
"pull_request_review_comment",
],
HookScope::Instance,
),
}
@ -2131,7 +2138,14 @@ mod tests {
assert_eq!(events(DeliveryKind::Issues), ["issues", "issue_assign"]);
assert_eq!(
events(DeliveryKind::PullRequest),
["pull_request", "pull_request_assign", "pull_request_sync"]
[
"pull_request",
"pull_request_assign",
"pull_request_sync",
"pull_request_review_approved",
"pull_request_review_rejected",
"pull_request_review_comment",
]
);
// The events a stored flow's source may name are the ones the hooks
// deliver to the router.

View file

@ -233,8 +233,8 @@ pub(super) enum DeliveryKind {
/// assigned, …), kept for the notification router (`crate::forge_events`).
#[strum(serialize = "issues")]
Issues,
/// Every `pull_request` event on every repo in the instance, kept the
/// same way.
/// Every `pull_request` event, and every submitted review, on every repo in
/// the instance, kept the same way.
#[strum(serialize = "pull-request")]
PullRequest,
}