matrix-bot: Better changelog

This commit is contained in:
Luis Hebendanz 2024-07-03 19:03:39 +02:00
parent aa5e6c7c7c
commit f4c8243e9c
2 changed files with 15 additions and 6 deletions

View File

@ -33,7 +33,7 @@ in
script = ''
set -euxo pipefail
mbot
mbot --changelog-room "\!FdCwyKsRlfooNYKYzx:matrix.org" --review-room "\!tmSRJlbsVXFUKAddiM:gchq.icu"
'';
};
}

View File

@ -2,6 +2,7 @@ import asyncio
import datetime
import json
import logging
import shlex
import subprocess
from pathlib import Path
@ -65,6 +66,7 @@ def write_file_with_date_prefix(
async def git_pull(repo_path: Path) -> None:
cmd = ["git", "pull"]
log.debug(f"Running command: {shlex.join(cmd)}")
process = await asyncio.create_subprocess_exec(
*cmd,
cwd=str(repo_path),
@ -81,6 +83,7 @@ async def git_log(repo_path: str, ndays: int) -> str:
"--stat",
"--patch",
]
log.debug(f"Running command: {shlex.join(cmd)}")
process = await asyncio.create_subprocess_exec(
*cmd,
cwd=repo_path,
@ -160,15 +163,21 @@ async def changelog_bot(
log.info(f"Generating changelog from {fromdate} to {todate}")
system_prompt = f"""
Create a concise changelog for the past week from {fromdate} to {todate}, focusing on new features and summarizing bug fixes into a single entry. Follow these guidelines:
Create a concise changelog for the past week from {fromdate} to {todate}.
Follow these guidelines:
- Discard duplicate entries
- Discard uninteresting changes
- Use present tense
- Keep the summary brief
- Follow commit message format: "scope: message (#number)"
- Link pull requests as: '{gitea.url}/{gitea.owner}/{gitea.repo}/pull/<number>'
- Mention each feature only once
- Link pull requests as: '{gitea.url}/{gitea.owner}/{gitea.repo}/pulls/<number>'
- Mention each scope and pull request number only once
- Have these headers in the changelog if applicable:
- New Features
- Bug Fixes
- Refactoring
- Documentation
- Removed Features
- Other Changes
Changelog:
---