From 39ad36115d368d79d4723b3a6b1cefe4874813a3 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Wed, 1 Nov 2023 00:00:00 +0000 Subject: feat(prs-create) add pr tag branch-name and title tag pr event with title, description and the name of the current checkedout branch --- src/sub_commands/prs/create.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/sub_commands') 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( .get_root_commit(to_branch) .context("failed to get root commit of the repository")?; + let mut pr_tags = vec![ + Tag::Reference(format!("r-{root_commit}")), + Tag::Name(title.to_string()), + Tag::Description(description.to_string()), + ]; + + if let Ok(branch_name) = git_repo.get_checked_out_branch_name() { + pr_tags.push(Tag::Generic( + TagKind::Custom("branch-name".to_string()), + vec![branch_name], + )); + } + let pr_event = EventBuilder::new( nostr::event::Kind::Custom(PR_KIND), format!("{title}\r\n\r\n{description}"), - &[Tag::Reference(format!("r-{root_commit}"))], - // TODO: suggested branch name - // Tag::Generic( - // TagKind::Custom("suggested-branch-name".to_string()), - // vec![], - // ), + &pr_tags, // TODO: add Repo event as root // TODO: people tag maintainers // TODO: add relay tags -- cgit v1.2.3