瀏覽代碼

Remove self-healing support

After the import of clippy as a subtree, there are bors-authored commits without
CI artifacts in the rust-lang/rust repository, which we do not want to return
from the API query.
Mark Rousskov 5 年之前
父節點
當前提交
6d4795c1ee
共有 1 個文件被更改,包括 15 次插入5 次删除
  1. 15 5
      src/handlers/rustc_commits.rs

+ 15 - 5
src/handlers/rustc_commits.rs

@@ -67,13 +67,23 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
         log::trace!("Ignoring bors merge, not on master");
         return Ok(());
     }
-    // We get the last several commits, and insert all of them. Our database
-    // handling just skips over commits that already existed, so we're not going
-    // to run into trouble, and this way we mostly self-heal (unless we're down
-    // for a long time).
+
+    let sha = bors.merge_sha;
+
+    // FIXME: ideally we would pull in all the commits here, but unfortunately
+    // in rust-lang/rust's case there's bors-authored commits that aren't
+    // actually from rust-lang/rust as they were merged into the clippy repo.
+    //
+    // For now we just ignore everything returned by this query other than the
+    // commit we *know* to be good (the one from the bors comment) but
+    // eventually we will want to be smarter here.
     let resp = ctx.github.bors_commits().await;
 
-    for mut gc in resp {
+    for mut gc in resp.into_iter() {
+        // Only insert the just pushed commit
+        if gc.sha != sha {
+            continue;
+        }
         let res = rustc_commits::record_commit(
             &ctx.db,
             rustc_commits::Commit {