From a038415c5f17fd78ad3a8abbbccf39ab20928c7e Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Mon, 15 Apr 2024 17:37:51 +0000 Subject: [PATCH 1/4] --- .config/mq.toml | 2 +- src/config.rs | 2 +- src/main.rs | 12 ++++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.config/mq.toml b/.config/mq.toml index 3af29dd..71edee6 100644 --- a/.config/mq.toml +++ b/.config/mq.toml @@ -1,5 +1,5 @@ # Default value: "singlequeue" -#mode = "singlequeue" +mode = "parallelqueue" # Default value: "none" #build = "none" diff --git a/src/config.rs b/src/config.rs index 04240d8..816ffdb 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,7 +19,7 @@ pub enum Build { #[derive(Config, Serialize)] pub struct Conf { - #[config(default = "singlequeue")] + #[config(default = "parallelqueue")] pub mode: Mode, #[config(default = "none")] diff --git a/src/main.rs b/src/main.rs index 328ac26..e8a8835 100644 --- a/src/main.rs +++ b/src/main.rs @@ -238,18 +238,22 @@ fn create_pull_request( } let mut body = config.pullrequest.body.to_string(); - body.push_str("\n\n[test]"); - body.push_str(&format!("\nflake rate: {}", config.test.flake_rate)); + body.push_str("\n\n[test]\n"); + body.push_str(&format!("flake rate: {}\n", config.test.flake_rate)); body.push_str(&format!( "\nlogical conflict every: {}", config.pullrequest.logical_conflict_every )); body.push_str(&format!( - "\nsleep for: {}s", + "sleep for: {}s\n", config.sleep_duration().as_secs() )); body.push_str(&format!( - "\n\n[pullrequest]\nrequests per hour: {}", + "close stale after: {}\n", + config.pullrequest.close_stale_after + )); + body.push_str(&format!( + "\n\n[pullrequest]\nrequests per hour: {}\n", config.pullrequest.requests_per_hour )); From 673e9bc8780ac75fb12375aaecf53d182bcc43f2 Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Mon, 15 Apr 2024 17:40:00 +0000 Subject: [PATCH 2/4] --- .config/mq.toml | 2 +- .trunk/trunk.yaml | 4 ++++ src/config.rs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.config/mq.toml b/.config/mq.toml index 71edee6..3af29dd 100644 --- a/.config/mq.toml +++ b/.config/mq.toml @@ -1,5 +1,5 @@ # Default value: "singlequeue" -mode = "parallelqueue" +#mode = "singlequeue" # Default value: "none" #build = "none" diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml index 8cf3bc8..3481e27 100644 --- a/.trunk/trunk.yaml +++ b/.trunk/trunk.yaml @@ -22,6 +22,10 @@ actions: - trunk-fmt-pre-commit - trunk-upgrade-available +lint: + enabled: + - clippy@1.77.2 + tools: enabled: - jq@jq-1.7.1 diff --git a/src/config.rs b/src/config.rs index 816ffdb..04240d8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -19,7 +19,7 @@ pub enum Build { #[derive(Config, Serialize)] pub struct Conf { - #[config(default = "parallelqueue")] + #[config(default = "singlequeue")] pub mode: Mode, #[config(default = "none")] From 06afdcfda908429990a7925bcfea91fbf4330b3c Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Mon, 15 Apr 2024 17:41:22 +0000 Subject: [PATCH 3/4] --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e8a8835..36f48be 100644 --- a/src/main.rs +++ b/src/main.rs @@ -241,7 +241,7 @@ fn create_pull_request( body.push_str("\n\n[test]\n"); body.push_str(&format!("flake rate: {}\n", config.test.flake_rate)); body.push_str(&format!( - "\nlogical conflict every: {}", + "logical conflict every: {}\n", config.pullrequest.logical_conflict_every )); body.push_str(&format!( From 3d16689566587b3dc64bd3372e07ad59d001bcbf Mon Sep 17 00:00:00 2001 From: Jane Doe Date: Mon, 15 Apr 2024 18:01:17 +0000 Subject: [PATCH 4/4] --- src/github.rs | 2 +- src/trunk.rs | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/github.rs b/src/github.rs index 527675e..2095ab0 100644 --- a/src/github.rs +++ b/src/github.rs @@ -31,7 +31,7 @@ pub struct Event { pub struct PullRequest { pub number: u32, pub head: Head, - pub body: String, + pub body: Option, } #[derive(Serialize, Deserialize, Debug)] diff --git a/src/trunk.rs b/src/trunk.rs index 85a84ab..4e3869a 100644 --- a/src/trunk.rs +++ b/src/trunk.rs @@ -8,12 +8,17 @@ use std::fs; pub fn upload_targets(config: &Conf, cli: &Cli, github_json_path: &str) { let github_json = fs::read_to_string(github_json_path).expect("Failed to read file"); - let ga = GitHubAction::from_json(&github_json); - let re = Regex::new(r".*deps=\[(.*?)\].*").unwrap(); + if !&ga.event.pull_request.body.is_some() { + // no body content to pull deps from + return; + } + + let re = Regex::new(r".*deps=\[(.*?)\].*").unwrap(); + let body = ga.event.pull_request.body.clone().unwrap(); let mut impacted_targets: Vec = Vec::new(); - if let Some(caps) = re.captures(&ga.event.pull_request.body) { + if let Some(caps) = re.captures(&body) { impacted_targets = caps[1] .split(',') .map(|s| s.trim().to_owned())