Skip to content

Commit

Permalink
add very basic PR description
Browse files Browse the repository at this point in the history
  • Loading branch information
Bendzae committed Jul 29, 2024
1 parent f34f21b commit 648c472
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 20 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,37 @@ impl GsContext {
let remote = self.repo.remote_repo_info()?;
let pulls = self.github.pulls(remote.owner, remote.name);

let mut created_pulls = vec![];
for (i, branch) in branches.iter().enumerate() {
let base = match i {
0 => &self.current_stack().unwrap().base_branch,
_ => &branches[i - 1],
};
let title = format!("{} (#{}) - {}", stack.prefix.clone().unwrap(), i, branch.split('/').last().unwrap());
let title = format!(
"{} (#{}) - {}",
stack.prefix.clone().unwrap(),
i,
branch.split('/').last().unwrap()
);

println!("base: {}, title: {}", base, title);
pulls
let pr = pulls
.create(title, branch, base)
.body("Created by [gstack](https://github.com/Bendzae/gstack)")
.send()
.await?;
println!("#{}: {}", pr.number, pr.html_url.clone().unwrap());
created_pulls.push(pr);
}

for pr in &created_pulls {
let mut body = "".to_string();
created_pulls
.iter()
.for_each(|p| body = body.clone() + format!("#{} \n", p.number).as_str());
body = body.clone() + "\nCreated by [gstack](https://github.com/Bendzae/gstack)";

pulls.update(pr.number).body(body).send().await?;
}

Ok(())
Expand Down

0 comments on commit 648c472

Please sign in to comment.