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.
2 files+25−20/2 viewed
| 33 | 33 | const MERGE_MINUTES: u64 = 2; | |
| 34 | 34 | /// Who a merge made by a repository's settings is attributed to. Not an | |
| 35 | 35 | /// 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"; | |
| 38 | 38 | /// How much of a failed check's output the author is shown. | |
| 39 | 39 | const MAX_CHECK_OUTPUT_CHARS: usize = 4_000; | |
| 40 | 40 | const MANAGED_PAGE: u32 = 200; |
| 129 | 129 | .await? | |
| 130 | 130 | .results::<HeadRow>()?; | |
| 131 | 131 | 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 | + | } | |
| 132 | 155 | self.publish_as( | |
| 133 | 156 | "checks.completed", | |
| 134 | 157 | &a.repo_id, |