浏览代码

Patch fix bot name (#7)

* 更改bot名称

* 注释doc update任务
LoGin 2 月之前
父节点
当前提交
48d7883ea4

+ 13 - 0
Cargo.lock

@@ -1817,6 +1817,7 @@ dependencies = [
  "serde_urlencoded",
  "tokio",
  "tokio-native-tls",
+ "tokio-socks",
  "tower-service",
  "url",
  "wasm-bindgen",
@@ -2466,6 +2467,18 @@ dependencies = [
  "tokio",
 ]
 
+[[package]]
+name = "tokio-socks"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "51165dfa029d2a65969413a6cc96f354b86b464498702f174a4efa13608fd8c0"
+dependencies = [
+ "either",
+ "futures-util",
+ "thiserror",
+ "tokio",
+]
+
 [[package]]
 name = "tokio-util"
 version = "0.6.9"

+ 1 - 1
Cargo.toml

@@ -10,7 +10,7 @@ edition = "2021"
 serde_json = "1"
 openssl = "0.10"
 dotenv = "0.15"
-reqwest = { version = "0.11.4", features = ["json", "blocking"] }
+reqwest = { version = "0.11.4", features = ["json", "blocking", "socks"] }
 regex = "1"
 lazy_static = "1"
 anyhow = "1"

+ 5 - 4
README.md

@@ -1,6 +1,8 @@
 # Triagebot
 
-This is the triage and team assistance bot for the rust-lang organization.
+这是为DragonOS Community提供分类和团队协助的机器人。
+
+它基于rust-lang的triagebot修改而来,感谢triagebot的作者们!
 
 Please see the [forge] for our documentation, and feel free to contribute edits
 if you find something helpful!
@@ -16,9 +18,8 @@ Triagebot can then respond to those notifications to perform various actions suc
 The Triagebot webserver also includes several other endpoints intended for users to access directly, such as https://triage.rust-lang.org/agenda.
 
 Triagebot uses a Postgres database to retain some state.
-In production, it uses [RDS](https://aws.amazon.com/rds/).
 
-The server at https://triage.rust-lang.org/ runs on ECS and is configured via [Terraform](https://github.com/rust-lang/simpleinfra/blob/master/terraform/shared/services/triagebot/main.tf#L8).
+triagebot服务的网址是 https://triagebot.dragonos.org.cn/ , 它运行在由中国雅安大数据产业园赞助的服务器上。 
 Updates are automatically deployed when merged to master.
 
 ## Installation
@@ -48,7 +49,7 @@ The general overview of what you will need to do:
 
 5. Run `cargo run --bin triagebot`. This starts the http server listening for webhooks on port 8000.
 6. Add a `triagebot.toml` file to the main branch of your GitHub repo with whichever services you want to try out.
-7. Try interacting with your repo, such as issuing `@rustbot` commands or interacting with PRs and issues (depending on which services you enabled in `triagebot.toml`). Watch the logs from the server to see what's going on.
+7. Try interacting with your repo, such as issuing `@dragonosbot` commands or interacting with PRs and issues (depending on which services you enabled in `triagebot.toml`). Watch the logs from the server to see what's going on.
 
 ### Configure a database
 

+ 1 - 1
github-graphql/src/lib.rs

@@ -283,7 +283,7 @@ pub mod project_items {
     #[derive(cynic::QueryFragment, Debug)]
     #[cynic(variables = "Arguments")]
     pub struct Query {
-        #[arguments(login: "rust-lang")]
+        #[arguments(login: "DragonOS-Community")]
         pub organization: Option<Organization>,
     }
 

+ 2 - 2
parser/src/command.rs

@@ -289,8 +289,8 @@ fn move_input_along_1() {
 
 #[test]
 fn multiname() {
-    let input = "@rustbot label to: +bug. Afterwards, delete the world. @triagebot prioritize";
-    let mut input = Input::new(input, vec!["triagebot", "rustbot"]);
+    let input = "@dragonosbot label to: +bug. Afterwards, delete the world. @triagebot prioritize";
+    let mut input = Input::new(input, vec!["triagebot", "dragonosbot"]);
     assert!(dbg!(input.next().unwrap()).is_ok());
     assert_eq!(
         &input.all[input.parsed..],

+ 1 - 1
src/config.rs

@@ -247,7 +247,7 @@ pub(crate) struct MajorChangeConfig {
     // This has a default primarily for backwards compatibility.
     #[serde(default = "MajorChangeConfig::enabling_label_default")]
     pub(crate) enabling_label: String,
-    /// This is the label applied when issuing a `@rustbot second` command, it
+    /// This is the label applied when issuing a `@dragonosbot second` command, it
     /// indicates that the proposal has moved into the 10 day waiting period.
     pub(crate) second_label: String,
     /// This is the label applied after the waiting period has successfully

+ 1 - 1
src/github.rs

@@ -1718,7 +1718,7 @@ impl<'q> IssuesQuery for Query<'q> {
         };
 
         let mut issues_decorator = Vec::new();
-        let re = regex::Regex::new("https://github.com/rust-lang/|/").unwrap();
+        let re = regex::Regex::new("https://github.com/DragonOS-Community/|/").unwrap();
         let re_zulip_link = regex::Regex::new(r"\[stream\]:\s").unwrap();
         for issue in issues {
             let fcp_details = if include_fcp_details {

+ 3 - 3
src/handlers/assign.rs

@@ -2,9 +2,9 @@
 //!
 //! This supports several ways for setting issue/PR assignment:
 //!
-//! * `@rustbot assign @gh-user`: Assigns to the given user.
-//! * `@rustbot claim`: Assigns to the comment author.
-//! * `@rustbot release-assignment`: Removes the commenter's assignment.
+//! * `@dragonosbot assign @gh-user`: Assigns to the given user.
+//! * `@dragonosbot claim`: Assigns to the comment author.
+//! * `@dragonosbot release-assignment`: Removes the commenter's assignment.
 //! * `r? @user`: Assigns to the given user (PRs only).
 //!
 //! This is capable of assigning to any user, even if they do not have write

+ 7 - 0
src/handlers/docs_update.rs

@@ -1,4 +1,6 @@
 //! A scheduled job to post a PR to update the documentation on rust-lang/rust.
+// 暂时允许unreachable code, 因为我们目前不需要这个任务,只是为了方便注释它。
+#![allow(unreachable_code)]
 
 use crate::github::{self, GitTreeEntry, GithubClient, Issue, Repository};
 use crate::jobs::Job;
@@ -26,6 +28,7 @@ const SUBMODULES: &[&str] = &[
 
 const TITLE: &str = "Update books";
 
+/// 这个任务用于更新文档仓库的submodule,并在文档仓库创建PR
 pub struct DocsUpdateJob;
 
 #[async_trait]
@@ -39,6 +42,10 @@ impl Job for DocsUpdateJob {
         _ctx: &super::Context,
         _metadata: &serde_json::Value,
     ) -> anyhow::Result<()> {
+        // 我们目前暂时不需要这个,因此直接返回Ok
+
+        return Ok(());
+
         // Only run every other week. Doing it every week can be a bit noisy, and
         // (rarely) a PR can take longer than a week to merge (like if there are
         // CI issues). `Schedule` does not allow expressing this, so check it

+ 2 - 2
src/handlers/major_change.rs

@@ -270,7 +270,7 @@ async fn handle(
         \n \
         ``` \
         \n \
-        @rustbot concern reason-for-concern \
+        @dragonosbot concern reason-for-concern \
         \n \
         <description of the concern> \
         \n \
@@ -280,7 +280,7 @@ async fn handle(
         \n \
         ``` \
         \n \
-        @rustbot resolve reason-for-concern \
+        @dragonosbot resolve reason-for-concern \
         \n \
         ``` \
         \n\n \

+ 4 - 4
src/handlers/milestone_prs.rs

@@ -20,13 +20,13 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
     }
 
     let repo = e.issue.repository();
-    if !(repo.organization == "rust-lang" && repo.repository == "rust") {
+    if !(repo.organization == "DragonOS-Community" && repo.repository == "DragonOS") {
         return Ok(());
     }
 
     if !e.issue.merged {
         log::trace!(
-            "Ignoring closing of rust-lang/rust#{}: not merged",
+            "Ignoring closing of DragonOS-Community/DragonOS#{}: not merged",
             e.issue.number
         );
         return Ok(());
@@ -36,7 +36,7 @@ pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
         s
     } else {
         log::error!(
-            "rust-lang/rust#{}: no merge_commit_sha in event",
+            "DragonOS-Community/DragonOS#{}: no merge_commit_sha in event",
             e.issue.number
         );
         return Ok(());
@@ -80,7 +80,7 @@ async fn get_version_standalone(
     let resp = gh
         .raw()
         .get(&format!(
-            "https://raw.githubusercontent.com/rust-lang/rust/{}/src/version",
+            "https://raw.githubusercontent.com/DragonOS-Community/DragonOS/{}/src/version",
             merge_sha
         ))
         .send()

+ 1 - 1
src/handlers/note.rs

@@ -3,7 +3,7 @@
 //! Users can make a new summary entry by commenting the following:
 //!
 //! ```md
-//! @rustbot note summary-title
+//! @dragonosbot note summary-title
 //! ```
 //!
 //! If this is the first summary entry, rustbot will amend the original post (the top-level comment) to add a "Notes" section. The section should **not** be edited by hand.

+ 2 - 2
src/handlers/pull_requests_assignment_update.rs

@@ -22,8 +22,8 @@ impl Job for PullRequestAssignmentUpdate {
 
         tracing::trace!("starting pull_request_assignment_update");
 
-        let rust_repo = gh.repository("rust-lang/rust").await?;
-        let prs = retrieve_pull_requests(&rust_repo, &gh).await?;
+        let dragonos_repo = gh.repository("DragonOS-Community/DragonOS").await?;
+        let prs = retrieve_pull_requests(&dragonos_repo, &gh).await?;
 
         // delete all PR assignments before populating
         init_table(&db).await?;

+ 1 - 1
src/main.rs

@@ -255,7 +255,7 @@ async fn run_server(addr: SocketAddr) -> anyhow::Result<()> {
         .expect("Failed to build octograb.");
     let ctx = Arc::new(Context {
         username: std::env::var("TRIAGEBOT_USERNAME").or_else(|err| match err {
-            std::env::VarError::NotPresent => Ok("rustbot".to_owned()),
+            std::env::VarError::NotPresent => Ok("dragonosbot".to_owned()),
             err => Err(err),
         })?,
         db: pool,