Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
Katyona-k committed Apr 15, 2024
1 parent 06afdcf commit 3d16689
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Event {
pub struct PullRequest {
pub number: u32,
pub head: Head,
pub body: String,
pub body: Option<String>,
}

#[derive(Serialize, Deserialize, Debug)]
Expand Down
11 changes: 8 additions & 3 deletions src/trunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = 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())
Expand Down

0 comments on commit 3d16689

Please sign in to comment.