diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2023-11-01 00:00:00 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2023-11-01 00:00:00 +0000 |
| commit | 39ad36115d368d79d4723b3a6b1cefe4874813a3 (patch) | |
| tree | a74ed0c389c46f7be90877d20bc705e0180a0686 /src/sub_commands/prs/create.rs | |
| parent | 6672f54dc166d7447e5c799f1809ecbb3d9ec04c (diff) | |
feat(prs-create) add pr tag branch-name and title
tag pr event with title, description and the name of the current
checkedout branch
Diffstat (limited to 'src/sub_commands/prs/create.rs')
| -rw-r--r-- | src/sub_commands/prs/create.rs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/sub_commands/prs/create.rs b/src/sub_commands/prs/create.rs index 655978e..ce30c12 100644 --- a/src/sub_commands/prs/create.rs +++ b/src/sub_commands/prs/create.rs | |||
| @@ -313,15 +313,23 @@ fn generate_pr_and_patch_events( | |||
| 313 | .get_root_commit(to_branch) | 313 | .get_root_commit(to_branch) |
| 314 | .context("failed to get root commit of the repository")?; | 314 | .context("failed to get root commit of the repository")?; |
| 315 | 315 | ||
| 316 | let mut pr_tags = vec![ | ||
| 317 | Tag::Reference(format!("r-{root_commit}")), | ||
| 318 | Tag::Name(title.to_string()), | ||
| 319 | Tag::Description(description.to_string()), | ||
| 320 | ]; | ||
| 321 | |||
| 322 | if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { | ||
| 323 | pr_tags.push(Tag::Generic( | ||
| 324 | TagKind::Custom("branch-name".to_string()), | ||
| 325 | vec![branch_name], | ||
| 326 | )); | ||
| 327 | } | ||
| 328 | |||
| 316 | let pr_event = EventBuilder::new( | 329 | let pr_event = EventBuilder::new( |
| 317 | nostr::event::Kind::Custom(PR_KIND), | 330 | nostr::event::Kind::Custom(PR_KIND), |
| 318 | format!("{title}\r\n\r\n{description}"), | 331 | format!("{title}\r\n\r\n{description}"), |
| 319 | &[Tag::Reference(format!("r-{root_commit}"))], | 332 | &pr_tags, |
| 320 | // TODO: suggested branch name | ||
| 321 | // Tag::Generic( | ||
| 322 | // TagKind::Custom("suggested-branch-name".to_string()), | ||
| 323 | // vec![], | ||
| 324 | // ), | ||
| 325 | // TODO: add Repo event as root | 333 | // TODO: add Repo event as root |
| 326 | // TODO: people tag maintainers | 334 | // TODO: people tag maintainers |
| 327 | // TODO: add relay tags | 335 | // TODO: add relay tags |