Skip to content

Commit 42778dc

Browse files
committed
chore: Replace git-cliff in the weekly-report command
1 parent a948be9 commit 42778dc

File tree

2 files changed

+19
-55
lines changed

2 files changed

+19
-55
lines changed

cliff-weekly-report.toml

Lines changed: 0 additions & 47 deletions
This file was deleted.

xtask/src/release.rs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ fn check_prerequisites() {
9898
std::process::exit(1);
9999
}
100100

101-
if cmd!(sh, "git cliff --version").quiet().ignore_stdout().run().is_err() {
102-
eprintln!("This command requires git-cliff, please install it.");
103-
eprintln!("More info can be found at: https://git-cliff.org/docs/installation/");
101+
if cmd!(sh, "gh version").quiet().ignore_stdout().run().is_err() {
102+
eprintln!("This command requires GitHub CLI, please install it.");
103+
eprintln!("More info can be found at: https://cli.github.com/");
104104

105105
std::process::exit(1);
106106
}
@@ -145,14 +145,25 @@ fn publish(execute: bool) -> Result<()> {
145145
}
146146

147147
fn weekly_report() -> Result<()> {
148+
const JSON_FIELDS: &'static str = "title,number,url,author";
149+
148150
let sh = sh();
149-
let lines = cmd!(sh, "git log --pretty=format:%H --since='1 week ago'").read()?;
150151

151-
let Some(start) = lines.split_whitespace().last() else {
152-
panic!("Could not find a start range for the git commit range.")
153-
};
152+
let one_week_ago = cmd!(sh, "date -d '1 week ago' +%Y-%m-%d").read()?;
153+
let today = cmd!(sh, "date +%Y-%m-%d").read()?;
154+
155+
let _env_pager = sh.push_env("GH_PAGER", "");
156+
157+
let header = format!("# This Week in the Matrix Rust SDK ({today})\n\n");
158+
let template = "{{range .}}- {{.title}} by @{{.author.login}}{{\"\\n\\n\"}}{{end}}";
159+
let template = format!("{header}{template}");
154160

155-
cmd!(sh, "git cliff --config cliff-weekly-report.toml {start}..HEAD").run()?;
161+
cmd!(
162+
sh,
163+
"gh pr list --search created:>{one_week_ago} --json {JSON_FIELDS} --template {template}"
164+
)
165+
.quiet()
166+
.run()?;
156167

157168
Ok(())
158169
}

0 commit comments

Comments
 (0)