Explorar el Código

Merge pull request #738 from spastorino/remove-prioritization-steps

Remove prioritization steps
Mark Rousskov hace 4 años
padre
commit
351ed94574
Se han modificado 3 ficheros con 5 adiciones y 257 borrados
  1. 1 234
      src/agenda.rs
  2. 3 22
      src/bin/prioritization.rs
  3. 1 1
      src/lib.rs

+ 1 - 234
src/prioritization.rs → src/agenda.rs

@@ -1,233 +1,7 @@
 use crate::actions::{Action, Query, QueryMap, Step};
 use crate::github;
 
-pub fn prepare_steps<'a>() -> Vec<Box<dyn Action>> {
-    vec![
-        unpri_i_prioritize(),
-        regressions(),
-        nominations(),
-        prs_waiting_on_team(),
-        agenda(),
-        final_review(),
-    ]
-}
-
-pub fn unpri_i_prioritize<'a>() -> Box<Step<'a>> {
-    let mut queries = Vec::new();
-
-    queries.push(QueryMap {
-        name: "unpri_i_prioritize_all",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-prioritize"],
-            exclude_labels: vec!["P-critical", "P-high", "P-medium", "P-low"],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "unpri_i_prioritize_t_compiler",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-prioritize", "T-compiler"],
-            exclude_labels: vec!["P-critical", "P-high", "P-medium", "P-low"],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "unpri_i_prioritize_libs_impl",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-prioritize", "libs-impl"],
-            exclude_labels: vec!["P-critical", "P-high", "P-medium", "P-low"],
-        },
-    });
-
-    Box::new(Step {
-        name: "unpri_i_prioritize",
-        actions: vec![Query {
-            repo: "rust-lang/rust",
-            queries,
-        }],
-    })
-}
-
-pub fn regressions<'a>() -> Box<Step<'a>> {
-    let mut queries = Vec::new();
-
-    queries.push(QueryMap {
-        name: "regressions_stable_to_beta",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["regression-from-stable-to-beta"],
-            exclude_labels: vec![
-                "P-critical",
-                "P-high",
-                "P-medium",
-                "P-low",
-                "T-infra",
-                "T-libs",
-                "T-release",
-                "T-rustdoc",
-            ],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "regressions_stable_to_nightly",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["regression-from-stable-to-nightly"],
-            exclude_labels: vec![
-                "P-critical",
-                "P-high",
-                "P-medium",
-                "P-low",
-                "T-infra",
-                "T-libs",
-                "T-release",
-                "T-rustdoc",
-            ],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "regressions_stable_to_stable",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["regression-from-stable-to-stable"],
-            exclude_labels: vec![
-                "P-critical",
-                "P-high",
-                "P-medium",
-                "P-low",
-                "T-infra",
-                "T-libs",
-                "T-release",
-                "T-rustdoc",
-            ],
-        },
-    });
-
-    Box::new(Step {
-        name: "regressions",
-        actions: vec![Query {
-            repo: "rust-lang/rust",
-            queries,
-        }],
-    })
-}
-
-pub fn nominations<'a>() -> Box<Step<'a>> {
-    let mut queries = Vec::new();
-
-    queries.push(QueryMap {
-        name: "nominations_stable_nominated",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![],
-            include_labels: vec!["stable-nominated"],
-            exclude_labels: vec!["stable-accepted"],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "nominations_beta_nominated",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![],
-            include_labels: vec!["beta-nominated"],
-            exclude_labels: vec!["beta-accepted"],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "nominations_i_nominated",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-nominated"],
-            exclude_labels: vec![],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "nominations_i_nominated_t_compiler",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-nominated", "T-compiler"],
-            exclude_labels: vec![],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "nominations_i_nominated_libs_impl",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["I-nominated", "libs-impl"],
-            exclude_labels: vec![],
-        },
-    });
-
-    Box::new(Step {
-        name: "nominations",
-        actions: vec![Query {
-            repo: "rust-lang/rust",
-            queries,
-        }],
-    })
-}
-
-pub fn prs_waiting_on_team<'a>() -> Box<Step<'a>> {
-    let mut queries = Vec::new();
-
-    queries.push(QueryMap {
-        name: "prs_waiting_on_team_all",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["S-waiting-on-team"],
-            exclude_labels: vec![],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "prs_waiting_on_team_t_compiler",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["S-waiting-on-team", "T-compiler"],
-            exclude_labels: vec![],
-        },
-    });
-
-    queries.push(QueryMap {
-        name: "prs_waiting_on_team_libs_impl",
-        query: github::Query {
-            kind: github::QueryKind::List,
-            filters: vec![("state", "open")],
-            include_labels: vec!["S-waiting-on-team", "libs-impl"],
-            exclude_labels: vec![],
-        },
-    });
-
-    Box::new(Step {
-        name: "prs_waiting_on_team",
-        actions: vec![Query {
-            repo: "rust-lang/rust",
-            queries,
-        }],
-    })
-}
-
-pub fn agenda<'a>() -> Box<Step<'a>> {
+pub fn prepare_agenda<'a>() -> Box<dyn Action> {
     let mut actions = Vec::new();
 
     let mut queries = Vec::new();
@@ -675,10 +449,3 @@ pub fn agenda<'a>() -> Box<Step<'a>> {
         actions,
     })
 }
-
-pub fn final_review<'a>() -> Box<Step<'a>> {
-    Box::new(Step {
-        name: "final_review",
-        actions: vec![],
-    })
-}

+ 3 - 22
src/bin/prioritization.rs

@@ -1,30 +1,11 @@
-use std::io::{self, Write};
-use triagebot::{logger, prioritization};
+use triagebot::{agenda, logger};
 
 #[tokio::main]
 async fn main() {
     dotenv::dotenv().ok();
     logger::init();
 
-    let prioritization_steps = prioritization::prepare_steps();
+    let agenda = agenda::prepare_agenda();
 
-    for step in &prioritization_steps {
-        print!("{}", step.call().await);
-
-        press_key_to_continue();
-    }
-}
-
-fn press_key_to_continue() {
-    let mut stdout = io::stdout();
-    stdout
-        .write(b"\n\n[Press Enter to continue]\n")
-        .expect("Unable to write to stdout");
-    stdout.flush().expect("Unable to flush stdout");
-
-    io::stdin()
-        .read_line(&mut String::new())
-        .expect("Unable to read user input");
-
-    stdout.write(b"\n").expect("Unable to write to stdout");
+    print!("{}", agenda.call().await);
 }

+ 1 - 1
src/lib.rs

@@ -9,6 +9,7 @@ use interactions::ErrorComment;
 use std::fmt;
 
 pub mod actions;
+pub mod agenda;
 pub mod config;
 pub mod db;
 pub mod github;
@@ -17,7 +18,6 @@ pub mod interactions;
 pub mod logger;
 pub mod notification_listing;
 pub mod payload;
-pub mod prioritization;
 pub mod team;
 mod team_data;
 pub mod zulip;