From fc4112d756e4976d82f01edbeb6ff8711a5713b4 Mon Sep 17 00:00:00 2001 From: pennae Date: Sun, 23 Oct 2022 18:42:05 +0200 Subject: fix landedness checks on non-updated prs `id` is only valid if the pr was updated in the same check, otherwise it must be pulled from the map key. --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1d09d86..50d0f4e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -278,7 +278,7 @@ fn sync_prs( .filter(|(_, cs)| !cs.is_empty()) .collect::>(); - for pr in state.pull_requests.values_mut() { + for (id, pr) in state.pull_requests.iter_mut() { let merge = match pr.merge_commit.as_ref() { Some(m) => m, None => continue, @@ -301,7 +301,7 @@ fn sync_prs( } else { bail!( "failed to check landing status of {}: {}, {}", - pr.id, + id, landed.status, String::from_utf8_lossy(&landed.stderr)); }; @@ -309,7 +309,7 @@ fn sync_prs( continue; } pr.landed_in.extend(landed.iter().cloned()); - new_history.push((Utc::now(), pr.id.clone(), PullAction::Landed(landed))); + new_history.push((Utc::now(), id.clone(), PullAction::Landed(landed))); } new_history.sort_by(|a, b| (a.0, &a.1, &a.2).cmp(&(b.0, &b.1, &b.2))); -- cgit v1.2.3