Commit

A stalled pull request picks back up when its workflows pass

When every workflow on the head of a pull request g1t stopped on has passed, and its acceptance checks have too (or it has none), the stall clears and the lifecycle decides again, within its usual limits. The timeline says so.

syntaqxcommitted Parent770d86fBrowse files
2 files+25−20/2 viewed
+2−2
3333 const MERGE_MINUTES: u64 = 2;
3434 /// Who a merge made by a repository's settings is attributed to. Not an
3535 /// account: `g1t` cannot be registered.
36−const POLICY_ACTOR_ID: &str = "g1t_policy";
37−const POLICY_ACTOR_NAME: &str = "g1t";
36+pub(crate) const POLICY_ACTOR_ID: &str = "g1t_policy";
37+pub(crate) const POLICY_ACTOR_NAME: &str = "g1t";
3838 /// How much of a failed check's output the author is shown.
3939 const MAX_CHECK_OUTPUT_CHARS: usize = 4_000;
4040 const MANAGED_PAGE: u32 = 200;
+23−0
129129 .await?
130130 .results::<HeadRow>()?;
131131 for head in heads {
132+ // A pull request g1t stopped on picks back up once what stopped
133+ // it passes: its workflows, and its checks if it has any. The
134+ // lifecycle then decides again, within its usual limits.
135+ if facts.failed.is_empty() {
136+ let resumed = self
137+ .db
138+ .prepare(
139+ "UPDATE pulls SET stalled = NULL WHERE id = ? AND managed = 1 AND stalled IS NOT NULL
140+ AND (check_status IS NULL OR check_status = 'passed') RETURNING id AS value",
141+ )
142+ .bind(&[head.id.as_str().into()])?
143+ .first::<crate::rows::ValueRow>(None)
144+ .await?;
145+ if resumed.is_some() {
146+ self.note(
147+ &a.repo_id,
148+ head.number,
149+ (crate::lifecycle::POLICY_ACTOR_ID, crate::lifecycle::POLICY_ACTOR_NAME),
150+ "picked this back up: its workflows pass now",
151+ )
152+ .await?;
153+ }
154+ }
132155 self.publish_as(
133156 "checks.completed",
134157 &a.repo_id,