feat: add hierarchical review numbering and pr description header
This commit is contained in:
@@ -14,6 +14,7 @@ pub struct PrMeta {
|
||||
pub repo: String,
|
||||
pub pr_index: i64,
|
||||
pub title: String,
|
||||
pub description: Option<String>,
|
||||
pub state: String,
|
||||
pub author: String,
|
||||
pub base_branch: String,
|
||||
|
||||
@@ -32,6 +32,7 @@ pub fn normalize_bundle(repo: &str, bundle: PullBundleDto) -> PrReviewDocument {
|
||||
repo: repo.to_string(),
|
||||
pr_index: pull.number,
|
||||
title: pull.title,
|
||||
description: pull.body,
|
||||
state: pull.state,
|
||||
author: pull.user.login,
|
||||
base_branch: pull.base.ref_name,
|
||||
|
||||
+14
-1
@@ -62,6 +62,18 @@ pub fn render_markdown(doc: &PrReviewDocument) -> String {
|
||||
"# {} `#{}` {}\n\n",
|
||||
doc.meta.repo, doc.meta.pr_index, doc.meta.title
|
||||
));
|
||||
out.push_str(
|
||||
"> 编号规则:Review `<pr>.<review>`;Comment `<pr>.<review>.<comment>`;Reply `<pr>.<review>.<comment>.<reply>`\n\n",
|
||||
);
|
||||
let pr_description = doc
|
||||
.meta
|
||||
.description
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty())
|
||||
.unwrap_or("_PR 描述为空_");
|
||||
out.push_str(pr_description);
|
||||
out.push_str("\n\n");
|
||||
|
||||
out.push_str("## Metadata\n\n");
|
||||
out.push_str(&format!("- state: {}\n", doc.meta.state));
|
||||
@@ -100,7 +112,8 @@ pub fn render_markdown(doc: &PrReviewDocument) -> String {
|
||||
|
||||
for (review_index, review) in doc.reviews.iter().enumerate() {
|
||||
out.push_str(&format!(
|
||||
"## Review {} ({})\n\n",
|
||||
"## Review {}.{} ({})\n\n",
|
||||
doc.meta.pr_index,
|
||||
review_index + 1,
|
||||
review.state
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user