You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"You are a technical writer tasked with creating organized and concise release notes. Categorize the following comma separated list of commit titles followed by their commit ids into markdown formatted subheadings. The heading cateogries are new features, bug fixes, infrastructure, and docs. If a category has no content, exclude it from the output. Do not format or alter the commit messages in any other way. Do not wrap the body of your result in markdown syntax highlighting ticks.\n\n{}",
17
-
text
18
-
);
19
-
20
-
let url = format!("http://{}:{}{}", ollama.domain, ollama.port, ollama.endpoint);
21
-
22
-
let response = client.post(&url)
23
-
.json(&json!({
24
-
"model": ollama.model,
25
-
"prompt": prompt,
26
-
"stream":false,
27
-
"options":{
28
-
"temperature": ollama.options.temperature,
29
-
"top_p": ollama.options.top_p,
30
-
"seed": ollama.options.seed
31
-
}
32
-
}))
33
-
.send()
34
-
.await.map_err(|e| ShipItError::Http(e))?
35
-
.json::<serde_json::Value>()
36
-
.await.map_err(|e| ShipItError::Http(e))?;
37
-
38
-
// Extract the response string from the JSON
39
-
let summary = response["response"]
40
-
.as_str()
41
-
.ok_or_else(|| ShipItError::Error("Failed to parse Ollama response!".to_string()))?;
.ok_or_else(|| ShipItError::Error("GitLab token not configured. Set gitlab.token in your shipit config.".to_string()))?;
137
-
138
-
let client = gitlab::Gitlab::builder(&ctx.settings.gitlab.domain, token).build_async().await.map_err(|e| ShipItError::Gitlab(e))?;
139
-
140
-
let create_mr = projects::merge_requests::CreateMergeRequest::builder()
141
-
.project(79411719)
142
-
.source_branch(&args_source)
143
-
.target_branch(&args_target)
144
-
.title(format!("{} to {}",&args_source,&args_target))
145
-
.description(&summary)
146
-
.remove_source_branch(true)
147
-
.build().map_err(|_e| ShipItError::Error("Failed to build a Gitlab MR!".to_string()))?;
148
-
149
-
let merge_request: serde_json::Value = create_mr.query_async(&client).await.map_err(|_e| ShipItError::Error("Failed to create a Gitlab merge request!".to_string()))?;
150
-
151
-
println!("\n\nThe merge request is available at:\n\n{}", merge_request["web_url"]);
98
+
// open an mr
99
+
if args_id.is_some(){
100
+
let project_id = args_id.as_ref().unwrap();
101
+
let token = ctx.settings.gitlab.token.as_deref()
102
+
.ok_or_else(|| ShipItError::Error("GitLab token not configured. Set gitlab.token in your shipit config.".to_string()))?;
let client = Gitlab::builder(domain, token).build_async().await.map_err(|e| ShipItError::Gitlab(e))?;
15
+
16
+
let create_mr = projects::merge_requests::CreateMergeRequest::builder()
17
+
.project(*project_id)
18
+
.source_branch(source)
19
+
.target_branch(target)
20
+
.title(format!("{} to {}", source, target))
21
+
.description(description)
22
+
.remove_source_branch(true)
23
+
.build().map_err(|_e| ShipItError::Error("Failed to build a Gitlab MR!".to_string()))?;
24
+
25
+
let merge_request: serde_json::Value = create_mr.query_async(&client).await.map_err(|_e| ShipItError::Error("Failed to create a Gitlab merge request!".to_string()))?;
"You are a technical writer tasked with creating organized and concise release notes. Categorize the following comma separated list of commit titles followed by their commit ids into markdown formatted subheadings. The heading cateogries are new features, bug fixes, infrastructure, and docs. If a category has no content, exclude it from the output. Do not format or alter the commit messages in any other way. Do not wrap the body of your result in markdown syntax highlighting ticks.\n\n{}",
36
+
text
37
+
);
38
+
39
+
let url = format!("http://{}:{}{}", ollama.domain, ollama.port, ollama.endpoint);
40
+
41
+
let response = client.post(&url)
42
+
.json(&json!({
43
+
"model": ollama.model,
44
+
"prompt": prompt,
45
+
"stream":false,
46
+
"options":{
47
+
"temperature": ollama.options.temperature,
48
+
"top_p": ollama.options.top_p,
49
+
"seed": ollama.options.seed
50
+
}
51
+
}))
52
+
.send()
53
+
.await.map_err(|e| ShipItError::Http(e))?
54
+
.json::<serde_json::Value>()
55
+
.await.map_err(|e| ShipItError::Http(e))?;
56
+
57
+
let summary = response["response"]
58
+
.as_str()
59
+
.ok_or_else(|| ShipItError::Error("Failed to parse Ollama response!".to_string()))?;
0 commit comments