Skip to content

Commit f16b2d4

Browse files
authored
Merge pull request #553 from Kobzol/rollup-try
Only require try permissions for marking a PR as rollup
2 parents bbbfc17 + df40372 commit f16b2d4

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/bors/handlers/review.rs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@ pub(super) async fn command_set_rollup(
239239
author: &GithubUser,
240240
rollup: RollupMode,
241241
) -> anyhow::Result<()> {
242-
if !has_permission(&repo_state, author, pr, PermissionType::Review).await? {
243-
deny_request(&repo_state, pr.number(), author, PermissionType::Review).await?;
242+
// Require only try for rollup commands, because rust-timer uses them, and we don't want to
243+
// grant it approve permissions.
244+
if !has_permission(&repo_state, author, pr, PermissionType::Try).await? {
245+
deny_request(&repo_state, pr.number(), author, PermissionType::Try).await?;
244246
return Ok(());
245247
}
246248
db.set_rollup(pr.db, rollup).await
@@ -1084,6 +1086,18 @@ approved = ["+foo", "+baz", "-bar", "-foo2"]
10841086
.await;
10851087
}
10861088

1089+
#[sqlx::test]
1090+
async fn set_rollup_try_permissions(pool: sqlx::PgPool) {
1091+
run_test(pool, async |ctx: &mut BorsTester| {
1092+
ctx.post_comment(Comment::new((), "@bors rollup=never").with_author(User::try_user()))
1093+
.await?;
1094+
ctx.wait_for_pr((), |pr| pr.rollup == Some(RollupMode::Never))
1095+
.await?;
1096+
Ok(())
1097+
})
1098+
.await;
1099+
}
1100+
10871101
#[sqlx::test]
10881102
async fn rollup_preserved_after_approve(pool: sqlx::PgPool) {
10891103
run_test(pool, async |ctx: &mut BorsTester| {

0 commit comments

Comments
 (0)