Skip to content

Commit 9c2a983

Browse files
committed
Ignore check run creation errors
1 parent 27e3a1c commit 9c2a983

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

src/bors/handlers/trybuild.rs

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
use std::sync::Arc;
22

3-
use anyhow::{Context, anyhow};
4-
use octocrab::params::checks::CheckRunOutput;
5-
use octocrab::params::checks::CheckRunStatus;
6-
73
use crate::PgDbClient;
84
use crate::bors::RepositoryState;
95
use crate::bors::command::Parent;
@@ -22,6 +18,10 @@ use crate::github::api::operations::ForcePush;
2218
use crate::github::{CommitSha, GithubUser, LabelTrigger, MergeError, PullRequestNumber};
2319
use crate::permissions::PermissionType;
2420
use crate::utils::text::suppress_github_mentions;
21+
use anyhow::{Context, anyhow};
22+
use octocrab::params::checks::CheckRunOutput;
23+
use octocrab::params::checks::CheckRunStatus;
24+
use tracing::log;
2525

2626
use super::has_permission;
2727
use super::{PullRequestData, deny_request};
@@ -100,7 +100,7 @@ pub(super) async fn command_try_build(
100100
// Create a check run to track the try build status in GitHub's UI.
101101
// This gets added to the PR's head SHA so GitHub shows UI in the checks tab and
102102
// the bottom of the PR.
103-
let check_run = repo
103+
match repo
104104
.client
105105
.create_check_run(
106106
TRY_BUILD_CHECK_RUN_NAME,
@@ -115,10 +115,17 @@ pub(super) async fn command_try_build(
115115
},
116116
&build_id.to_string(),
117117
)
118-
.await?;
119-
120-
db.update_build_check_run_id(build_id, check_run.id.into_inner() as i64)
121-
.await?;
118+
.await
119+
{
120+
Ok(check_run) => {
121+
db.update_build_check_run_id(build_id, check_run.id.into_inner() as i64)
122+
.await?;
123+
}
124+
Err(error) => {
125+
// Check runs aren't critical, don't block progress if they fail
126+
log::error!("Cannot create check run: {error:?}");
127+
}
128+
}
122129

123130
repo.client
124131
.post_comment(

0 commit comments

Comments
 (0)