Skip to content

Commit d9db4d3

Browse files
Refactor try build already in progress error
1 parent 6b12285 commit d9db4d3

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/bors/handlers/trybuild.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,16 @@ pub(super) async fn command_try_build(
6565
.await
6666
.context("Cannot find or create PR")?;
6767

68+
if let Some(build) = &pr_model.try_build {
69+
if build.status == BuildStatus::Pending {
70+
tracing::warn!("Try build already in progress");
71+
repo.client
72+
.post_comment(pr.number, try_build_in_progress_comment())
73+
.await?;
74+
return Ok(());
75+
}
76+
}
77+
6878
let base_sha = match get_base_sha(&pr_model, parent) {
6979
Ok(Some(base_sha)) => base_sha,
7080
Ok(None) => repo
@@ -171,12 +181,7 @@ fn get_base_sha(
171181
parent: Option<Parent>,
172182
) -> Result<Option<CommitSha>, Comment> {
173183
let last_parent = if let Some(ref build) = pr_model.try_build {
174-
if build.status == BuildStatus::Pending {
175-
tracing::warn!("Try build already in progress");
176-
return Err(try_build_in_progress_comment());
177-
} else {
178-
Some(CommitSha(build.parent.clone()))
179-
}
184+
Some(CommitSha(build.parent.clone()))
180185
} else {
181186
None
182187
};

0 commit comments

Comments
 (0)