Skip to content

Commit e5728e1

Browse files
committed
Log the whole diff for branch protections and make sure that we don't forget to update the diff again
1 parent f619e51 commit e5728e1

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

sync-team/src/github/mod.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,9 +950,21 @@ fn log_branch_protection(
950950
new: Option<&api::BranchProtection>,
951951
mut result: impl Write,
952952
) -> std::fmt::Result {
953+
let api::BranchProtection {
954+
// Pattern identifies the branch protection, so it has to be same between `current`
955+
// and `new`.
956+
pattern: _,
957+
is_admin_enforced,
958+
dismisses_stale_reviews,
959+
required_approving_review_count,
960+
required_status_check_contexts,
961+
push_allowances,
962+
requires_approving_reviews,
963+
} = current;
964+
953965
macro_rules! log {
954966
($str:literal, $field1:ident) => {
955-
let old = &current.$field1;
967+
let old = $field1;
956968
let new = new.map(|n| &n.$field1);
957969
log!($str, old, new);
958970
};
@@ -968,10 +980,12 @@ fn log_branch_protection(
968980
}
969981

970982
log!("Dismiss Stale Reviews", dismisses_stale_reviews);
983+
log!("Is admin enforced", is_admin_enforced);
971984
log!(
972985
"Required Approving Review Count",
973986
required_approving_review_count
974987
);
988+
log!("Requires PR", requires_approving_reviews);
975989
log!("Required Checks", required_status_check_contexts);
976990
log!("Allowances", push_allowances);
977991
Ok(())

0 commit comments

Comments
 (0)