forked from clan/clan-infra
matrix-bot: Better changelog
This commit is contained in:
parent
aa5e6c7c7c
commit
f4c8243e9c
@ -33,7 +33,7 @@ in
|
|||||||
script = ''
|
script = ''
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
mbot
|
mbot --changelog-room "\!FdCwyKsRlfooNYKYzx:matrix.org" --review-room "\!tmSRJlbsVXFUKAddiM:gchq.icu"
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import asyncio
|
|||||||
import datetime
|
import datetime
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@ -65,6 +66,7 @@ def write_file_with_date_prefix(
|
|||||||
|
|
||||||
async def git_pull(repo_path: Path) -> None:
|
async def git_pull(repo_path: Path) -> None:
|
||||||
cmd = ["git", "pull"]
|
cmd = ["git", "pull"]
|
||||||
|
log.debug(f"Running command: {shlex.join(cmd)}")
|
||||||
process = await asyncio.create_subprocess_exec(
|
process = await asyncio.create_subprocess_exec(
|
||||||
*cmd,
|
*cmd,
|
||||||
cwd=str(repo_path),
|
cwd=str(repo_path),
|
||||||
@ -81,6 +83,7 @@ async def git_log(repo_path: str, ndays: int) -> str:
|
|||||||
"--stat",
|
"--stat",
|
||||||
"--patch",
|
"--patch",
|
||||||
]
|
]
|
||||||
|
log.debug(f"Running command: {shlex.join(cmd)}")
|
||||||
process = await asyncio.create_subprocess_exec(
|
process = await asyncio.create_subprocess_exec(
|
||||||
*cmd,
|
*cmd,
|
||||||
cwd=repo_path,
|
cwd=repo_path,
|
||||||
@ -160,15 +163,21 @@ async def changelog_bot(
|
|||||||
log.info(f"Generating changelog from {fromdate} to {todate}")
|
log.info(f"Generating changelog from {fromdate} to {todate}")
|
||||||
|
|
||||||
system_prompt = f"""
|
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
|
- Use present tense
|
||||||
- Keep the summary brief
|
- Keep the summary brief
|
||||||
- Follow commit message format: "scope: message (#number)"
|
- Follow commit message format: "scope: message (#number)"
|
||||||
- Link pull requests as: '{gitea.url}/{gitea.owner}/{gitea.repo}/pull/<number>'
|
- Link pull requests as: '{gitea.url}/{gitea.owner}/{gitea.repo}/pulls/<number>'
|
||||||
- Mention each feature only once
|
- 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:
|
Changelog:
|
||||||
---
|
---
|
||||||
|
Loading…
Reference in New Issue
Block a user