Skip to content

Commit

Permalink
feat: rerequest github check run upon job restart
Browse files Browse the repository at this point in the history
  • Loading branch information
jiegec committed Mar 14, 2024
1 parent 18098bb commit bcd869d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion buildit-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
octocrab = "0.34"
octocrab = "0.35.0"
jsonwebtoken = "9"
anyhow = "1"
tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread", "process", "sync", "fs"] }
Expand Down
2 changes: 1 addition & 1 deletion server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ common = { path = "../common" }
dotenv = "0.15.0"
env_logger = "0.11.2"
futures = "0.3.30"
octocrab = "0.34.1"
octocrab = "0.35.0"
once_cell = "1.19.0"
reqwest = "0.11.24"
serde = { version = "1.0.196", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion server/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ pub async fn pipeline_new(
match crab
.checks("AOSC-Dev", "aosc-os-abbs")
.create_check_run(format!("buildit {}", arch), &git_sha)
.status(octocrab::params::checks::CheckRunStatus::InProgress)
.status(octocrab::params::checks::CheckRunStatus::Queued)
.send()
.await
{
Expand Down
17 changes: 8 additions & 9 deletions server/src/routes/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ pub async fn job_restart(
match get_crab_github_installation().await {
Ok(Some(crab)) => {
let handler = crab.checks("AOSC-Dev", "aosc-os-abbs");
let mut builder = handler
.update_check_run(CheckRunId(github_check_run_id as u64))
.status(octocrab::params::checks::CheckRunStatus::InProgress);

if let Err(e) = builder.send().await {
warn!("Failed to update github check run: {e}");
// https://docs.github.com/en/rest/checks/runs?apiVersion=2022-11-28#rerequest-a-check-run
if let Err(e) = handler
.rerequest_check_run(CheckRunId(github_check_run_id as u64))
.send()
.await
{
warn!("Failed to rerequest github check run: {e}");
}
}
Ok(None) => {
Expand All @@ -230,7 +231,5 @@ pub async fn job_restart(
}
}

Ok(Json(JobRestartResponse {
job_id: new_job.id,
}))
Ok(Json(JobRestartResponse { job_id: new_job.id }))
}

0 comments on commit bcd869d

Please sign in to comment.