File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -321,8 +321,24 @@ impl SyncGitHub {
321
321
. branch_protections ( & actual_repo. org , & actual_repo. name ) ?;
322
322
for branch_protection in & expected_repo. branch_protections {
323
323
let actual_branch_protection = actual_protections. remove ( & branch_protection. pattern ) ;
324
- let expected_branch_protection =
324
+ let mut expected_branch_protection =
325
325
construct_branch_protection ( expected_repo, branch_protection) ;
326
+
327
+ // We don't model GitHub App push allowance actors in team.
328
+ // However, we don't want to remove existing accesses of GH apps to
329
+ // branches.
330
+ // So if there is an existing branch protection, we copy its GitHub app
331
+ // push allowances into the expected branch protection, to roundtrip the app access.
332
+ if let Some ( ( _, actual_branch_protection) ) = & actual_branch_protection {
333
+ expected_branch_protection. push_allowances . extend (
334
+ actual_branch_protection
335
+ . push_allowances
336
+ . iter ( )
337
+ . filter ( |allowance| matches ! ( allowance, PushAllowanceActor :: App ( _) ) )
338
+ . cloned ( ) ,
339
+ ) ;
340
+ }
341
+
326
342
let operation = {
327
343
match actual_branch_protection {
328
344
Some ( ( database_id, bp) ) if bp != expected_branch_protection => {
You can’t perform that action at this time.
0 commit comments