upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/pull_request.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2023-05-21 11:21:01 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2023-05-21 11:21:01 +0000
commit6f44c872a347907737cc1d2f9e49da201142044e (patch)
tree28d7e56ddd396b7a40d3b1c2bd83e2509f848228 /src/pull_request.rs
parenta579e90666d49a0f9353319525b1790ad7b26c4a (diff)
merge, patch, pull requests and repo_config
Diffstat (limited to 'src/pull_request.rs')
-rw-r--r--src/pull_request.rs39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/pull_request.rs b/src/pull_request.rs
new file mode 100644
index 0000000..a87fa45
--- /dev/null
+++ b/src/pull_request.rs
@@ -0,0 +1,39 @@
1use nostr::{Event, EventBuilder, Keys };
2
3
4use crate::{ngit_tag::{tag_repo, tag_branch, tag_branch_merge_from, tag_hashtag, tag_into_event}, kind::Kind};
5
6pub fn initialize_pull_request(
7 keys: &Keys,
8 repoistory:&String,
9 to_branch_id: &String,
10 from_branch_id: &String,
11 title: &String,
12 description: &String,
13 hashtags: Vec<String>,
14
15) -> Event {
16 let mut tags = vec![
17 tag_repo(repoistory),
18 tag_into_event(tag_repo(repoistory)),
19 tag_branch(to_branch_id),
20 tag_into_event(tag_branch(to_branch_id)),
21 tag_branch_merge_from(from_branch_id),
22 tag_into_event(tag_branch_merge_from(from_branch_id)),
23 tag_hashtag("ngit-event"),
24 tag_hashtag("ngit-format-0.0.1"),
25];
26 for t in hashtags.iter() {
27 tags.push(
28 nostr::Tag::Hashtag(t.to_string())
29 )
30 }
31 EventBuilder::new(
32 Kind::PullRequest.into_sdk_custom_kind(),
33 format!("PullRequest\n{title}\n\n{description}"),
34 &tags,
35 )
36 .to_unsigned_event(keys.public_key())
37 .sign(&keys)
38 .unwrap()
39}