Fix deserialization of PullRequest with empty body in changelog tool

This commit is contained in:
Héctor Ramón Jiménez 2024-09-18 02:26:01 +02:00
parent e36e042093
commit ce5834979c
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 9 additions and 4 deletions

View file

@ -306,7 +306,7 @@ impl Contribution {
pub struct PullRequest {
pub id: u64,
pub title: String,
pub description: String,
pub description: Option<String>,
pub labels: Vec<String>,
pub author: String,
}
@ -334,7 +334,7 @@ impl PullRequest {
#[derive(Deserialize)]
struct Schema {
title: String,
body: String,
body: Option<String>,
user: User,
labels: Vec<Label>,
}

View file

@ -90,8 +90,13 @@ impl Generator {
return Task::none();
};
let description =
markdown::parse(&pull_request.description).collect();
let description = markdown::parse(
pull_request
.description
.as_deref()
.unwrap_or("*No description provided*"),
)
.collect();
*state = State::Loaded {
title: pull_request.title.clone(),