Commitlist (Release note utils )document fix#78330
Open
A-nnonymous wants to merge 3 commits intoPaddlePaddle:developfrom
Open
Commitlist (Release note utils )document fix#78330A-nnonymous wants to merge 3 commits intoPaddlePaddle:developfrom
A-nnonymous wants to merge 3 commits intoPaddlePaddle:developfrom
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
你的PR提交成功,感谢你对开源项目的贡献! |
Contributor
There was a problem hiding this comment.
Pull request overview
Adds/updates a tools/commitlist.py utility to generate release-note worksheets from a git commit range, optionally enriching commit-derived PR numbers with GitHub GraphQL metadata and exporting per-category Markdown/CSV artifacts.
Changes:
- Introduce a CLI tool to collect commits between two refs (merge-base default) and extract PR numbers from commit titles.
- Fetch PR metadata (labels, author, approvals, body sections) via GitHub GraphQL with a local JSON cache.
- Generate
commitlist.csv,contributors.txt, and per-categoryexport/<category>/result_<category>.{md,csv}outputs.
Comments suppressed due to low confidence (4)
tools/commitlist.py:589
render_markdown()is defined but never used (no call sites in this script). If a combined markdown summary is intended, consider writing it to an output file (and documenting it); otherwise removing the unused function will reduce maintenance surface.
def render_markdown(
commits: list[CommitRow], base_ref: str, head_ref: str
) -> str:
lines = [
'# Release Notes\n\n',
f'- Range: `{base_ref}..{head_ref}`\n',
f'- Commits: {len(commits)}\n\n',
]
categories = ordered_values(
(commit.category for commit in commits), PR_CATEGORIES
)
for category in categories:
lines.append(f'## {category}\n\n')
category_commits = [
commit for commit in commits if commit.category == category
]
topics = ordered_values(
(commit.topic for commit in category_commits), PR_TYPES
)
for topic in topics:
topic_commits = [
commit for commit in category_commits if commit.topic == topic
]
if not topic_commits:
continue
lines.append(f'### {topic}\n\n')
for commit in topic_commits:
lines.append(
f'- {markdown_entry_text(commit)} ({get_hash_or_pr_url(commit)})\n'
)
lines.append('\n')
tools/commitlist.py:552
- The generated worksheet header text has grammatical issues (e.g., "human read friendly"). Since this content is written into output docs, please adjust the wording to something like "human-readable" to avoid propagating typos into release-note worksheets.
def get_markdown_header(category: str) -> str:
return (
f'# Release Notes worksheet {category}\n'
'- polish PR title to make it human read friendly.\n'
tools/commitlist.py:283
- Parsing
git logoutput withrecord.split('\x1f')can raiseValueErrorif the commit subject unexpectedly contains the separator character, which would crash the script. Consider switching to a separator that cannot appear in commit subjects (e.g., NUL via%x00) and/or guarding against malformed splits so the tool degrades gracefully.
commits = []
for record in raw_log.split('\x1e'):
record = record.strip()
if not record:
continue
tools/commitlist.py:301
PullRequestCacheassumes the cache file is valid JSON; if it becomes truncated/corrupted,json.loads()will raise and the tool will fail even though it could regenerate the cache. Consider catchingJSONDecodeError/OSErrorhere and treating it as an empty cache (optionally warning to stderr).
class PullRequestCache:
def __init__(self, path: Path):
self.path = path
self.path.parent.mkdir(parents=True, exist_ok=True)
self._data: dict[str, dict[str, object]] = {}
if self.path.exists():
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
15
to
+31
|
|
||
|
|
||
| """Generate release-note worksheets from git history and GitHub PR metadata. | ||
|
|
||
| By default the script walks commits in | ||
| `merge-base(base_ref, head_ref)..head_ref`, extracts PR numbers from commit | ||
| titles such as `... (#12345)`, optionally enriches them with GitHub GraphQL | ||
| metadata, and writes: | ||
|
|
||
| - `commitlist.csv` | ||
| - `contributors.txt` | ||
| - `export/<category>/result_<category>.md` | ||
| - `export/<category>/result_<category>.csv` | ||
|
|
||
| Category and topic prefer the `release notes:` and `topic:` labels. If those | ||
| labels are absent, the script falls back to the `PR Category`, `PR Types`, and | ||
| `Description` sections in the PR body. `--local-only` skips GitHub lookups and |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Category
User Experience
PR Types
Docs
Description
Commitlist document fix
pcard-91067
是否引起精度变化
否