From fc11eeca44e6f3e7be32cf2050938b2d6d897d0b Mon Sep 17 00:00:00 2001 From: Dimitri Mitropoulos Date: Thu, 19 Sep 2024 09:36:38 -0400 Subject: [PATCH] fix (I don't love the Box::leak, but couldn't find another way) --- crates/turborepo-scm/src/git.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/turborepo-scm/src/git.rs b/crates/turborepo-scm/src/git.rs index 4989e64f787499..b0bc34db2a8965 100644 --- a/crates/turborepo-scm/src/git.rs +++ b/crates/turborepo-scm/src/git.rs @@ -117,13 +117,13 @@ impl Git { return Some(pr); } - // we must be in a push event of a PR + // we must be in a push event // try reading from the GITHUB_EVENT_PATH file if let Ok(event_path) = env::var("GITHUB_EVENT_PATH") { // Try to open the event file and read the contents let mut file = File::open(event_path).ok()?; let mut data = String::new(); - file.read_to_string(&mut data).ok?; + file.read_to_string(&mut data).ok()?; // Parse the JSON data from the file let json: Value = serde_json::from_str(&data).ok()?; @@ -147,7 +147,7 @@ impl Git { } if let Some(github_base_ref) = Self::get_github_base_ref() { - return Ok(github_base_ref.as_str()); + return Ok(Box::leak(github_base_ref.into_boxed_str())); } let main_result = self.execute_git_command(&["rev-parse", "main"], "");