upleb.uk

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

summaryrefslogtreecommitdiff
path: root/src/pull_request.rs
blob: a87fa4525ccd4fa45a597fe9acc2fa19cfd1badd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
use nostr::{Event, EventBuilder, Keys };


use crate::{ngit_tag::{tag_repo, tag_branch, tag_branch_merge_from, tag_hashtag, tag_into_event}, kind::Kind};

pub fn initialize_pull_request(
    keys: &Keys,
    repoistory:&String,
    to_branch_id: &String,
    from_branch_id: &String,
    title: &String,
    description: &String,
    hashtags: Vec<String>,

) -> Event {
    let mut tags = vec![
        tag_repo(repoistory),
        tag_into_event(tag_repo(repoistory)),
        tag_branch(to_branch_id),
        tag_into_event(tag_branch(to_branch_id)),
        tag_branch_merge_from(from_branch_id),
        tag_into_event(tag_branch_merge_from(from_branch_id)),
        tag_hashtag("ngit-event"),
        tag_hashtag("ngit-format-0.0.1"),
];
    for t in hashtags.iter() {
        tags.push(
            nostr::Tag::Hashtag(t.to_string())
        )
    }
    EventBuilder::new(
        Kind::PullRequest.into_sdk_custom_kind(),
        format!("PullRequest\n{title}\n\n{description}"),
        &tags,
    )
    .to_unsigned_event(keys.public_key())
    .sign(&keys)
    .unwrap()
}