Skip to content
This repository was archived by the owner on Mar 31, 2025. It is now read-only.

Commit 4f0c8a6

Browse files
KobzolMark-Simulacrum
authored andcommitted
Do not treat GitHub apps as bots
1 parent 92c3e8a commit 4f0c8a6

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/github/mod.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -384,10 +384,12 @@ fn calculate_permission_diffs(
384384
permissions.push(diff);
385385
}
386386
// Bot permissions
387-
let bots = expected_repo.bots.iter().map(|b| {
388-
let bot_name = bot_name(b);
387+
let bots = expected_repo.bots.iter().filter_map(|b| {
388+
let Some(bot_name) = bot_name(b) else {
389+
return None;
390+
};
389391
actual_teams.remove(bot_name);
390-
(bot_name, RepoPermission::Write)
392+
Some((bot_name, RepoPermission::Write))
391393
});
392394
// Member permissions
393395
let members = expected_repo
@@ -441,13 +443,14 @@ fn calculate_permission_diffs(
441443
Ok(permissions)
442444
}
443445

444-
fn bot_name(bot: &Bot) -> &str {
446+
/// Returns `None` if the bot is not an actual bot user, but rather a GitHub app.
447+
fn bot_name(bot: &Bot) -> Option<&str> {
445448
match bot {
446-
Bot::Bors => "bors",
447-
Bot::Highfive => "rust-highfive",
448-
Bot::RustTimer => "rust-timer",
449-
Bot::Rustbot => "rustbot",
450-
Bot::Rfcbot => "rfcbot",
449+
Bot::Bors => Some("bors"),
450+
Bot::Highfive => Some("rust-highfive"),
451+
Bot::RustTimer => Some("rust-timer"),
452+
Bot::Rustbot => Some("rustbot"),
453+
Bot::Rfcbot => Some("rfcbot"),
451454
}
452455
}
453456

0 commit comments

Comments
 (0)