Factory: close finished issues, Done column on the right
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fcbc052f8e
commit
df02556132
8 files changed
+90
-5
No files matched your search
+15
-1
@@ -552,6 +552,12 @@ impl Forge {
|
||||
Ok(out)
|
||||
}
|
||||
|
||||
/// Is the issue still open on the forge?
|
||||
pub async fn issue_is_open(&self, number: u64) -> Result<bool> {
|
||||
let v = self.call(reqwest::Method::GET, self.rp(&format!("/issues/{number}")), None).await?;
|
||||
Ok(!matches!(v["state"].as_str(), Some("closed")))
|
||||
}
|
||||
|
||||
pub async fn close_issue(&self, number: u64) -> Result<()> {
|
||||
match self.kind {
|
||||
Kind::Gitlab => self.call(reqwest::Method::PUT, self.rp(&format!("/issues/{number}")), Some(json!({"state_event": "close"}))).await.map(|_| ()),
|
||||
@@ -730,7 +736,7 @@ fn urlenc(s: &str) -> String {
|
||||
// --- engine -----------------------------------------------------------------------
|
||||
|
||||
/// The marker with which every bot comment starts (the poller ignores these when it looks for answers).
|
||||
const BOT: &str = "<!-- codecraft-factory -->";
|
||||
pub(crate) const BOT: &str = "<!-- codecraft-factory -->";
|
||||
|
||||
/// Machine-readable result at the end of a phase: the last fenced ```json block, else the last
|
||||
/// top-level object in the text. Needs a "decision" field.
|
||||
@@ -1334,6 +1340,14 @@ pub async fn poll_repo(app: &Arc<App>, user: &User, cfg: &RepoCfg) -> Result<()>
|
||||
app.store.factory_issue_set(&cfg.url, n, &[("title", json!(title)), ("state", json!("review"))])?;
|
||||
tokio::spawn(review(app.clone(), user.clone(), cfg.clone(), issue, comments));
|
||||
}
|
||||
// Accepted issues that were closed on the forge (by hand or by the factory) leave the "done" column.
|
||||
let open: Vec<i64> = g.issues(&cfg.label).await.unwrap_or_default().iter().map(issue_no).collect();
|
||||
for row in app.store.factory_issues(&user.id)?.into_iter().filter(|r| r["repo"].as_str() == Some(cfg.url.as_str()) && r["state"].as_str() == Some("done")) {
|
||||
let n = issue_no(&row);
|
||||
if !open.contains(&n) && !g.issue_is_open(n as u64).await.unwrap_or(true) {
|
||||
app.store.factory_issue_set(&cfg.url, n, &[("state", json!("closed"))])?;
|
||||
}
|
||||
}
|
||||
// Merged issues get their version and tag.
|
||||
if let Err(e) = crate::factory_version::version_pass(app, user, cfg).await {
|
||||
tracing::warn!("factory {}: versions: {e:#}", cfg.url);
|
||||
|
||||
Reference in new issue
Block a user