Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/github/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ pub struct GhCheckRunsResponse {

#[derive(Debug, Deserialize)]
pub struct GhCheckRun {
pub id: u64,
pub name: String,
pub status: String,
pub conclusion: Option<String>,
Expand Down
21 changes: 16 additions & 5 deletions src/queue/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,22 @@ async fn poll_checks(
continue;
}

let all_completed = checks.check_runs.iter().all(|c| c.status == "completed");
// Deduplicate check runs by name, keeping the latest (highest ID).
// GitHub can produce duplicate runs (e.g. from re-triggers) where
// an older run stays "in_progress" forever while the newer one completed.
let mut latest: std::collections::HashMap<&str, &crate::github::types::GhCheckRun> =
std::collections::HashMap::new();
for run in &checks.check_runs {
let entry = latest.entry(run.name.as_str()).or_insert(run);
if run.id > entry.id {
*entry = run;
}
}
let deduped: Vec<&&crate::github::types::GhCheckRun> = latest.values().collect();

let all_completed = deduped.iter().all(|c| c.status == "completed");
if !all_completed {
let pending: Vec<&str> = checks
.check_runs
let pending: Vec<&str> = deduped
.iter()
.filter(|c| c.status != "completed")
.map(|c| c.name.as_str())
Expand All @@ -610,8 +622,7 @@ async fn poll_checks(
continue;
}

let failed: Vec<String> = checks
.check_runs
let failed: Vec<String> = deduped
.iter()
.filter(|c| {
!matches!(
Expand Down