Skip to content

Commit 4f2af68

Browse files
committed
chore(docs): centralise changelog entries for open versions
Pull requests for user-visible changes each adding a bullet to the unreleased version's changelog file conflict on every merge. CONTRIBUTING.md now says the maintainer writes those entries centrally, and that such PRs leave the file out of the diff. The PR template's changelog box and the generator that annotates it follow the same rule. Refs #2449
1 parent 4ca3f30 commit 4f2af68

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

‎.github/PULL_REQUEST_TEMPLATE.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
- [ ] [Searched](https://github.com/JarryShaw/PyPCAPKit/pulls?q=is%3Apr) for similar pull requests
88
- [ ] Followed the [coding style](https://github.com/JarryShaw/PyPCAPKit/blob/main/CONTRIBUTING.md#coding-style) (`make pylint`, `make mypy`, `make isort`)
99
- [ ] `make test` passes, and a test case covers the change
10-
- [ ] Added a [changelog entry](https://github.com/JarryShaw/PyPCAPKit/blob/main/CONTRIBUTING.md#changelog-entries) under `docs/source/changelog/` and regenerated `CHANGELOG.md`, if the change is user-visible
10+
- [ ] Described the user-visible change above and left its [changelog entry](https://github.com/JarryShaw/PyPCAPKit/blob/main/CONTRIBUTING.md#changelog-entries) to the maintainer, keeping `docs/source/changelog/` and `CHANGELOG.md` out of the diff, if the change is user-visible
1111

1212
### What is the purpose of your *pull request*?
1313

‎CONTRIBUTING.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ A rough outline:
2525
- Create a topic branch, usually from `main`.
2626
- Make commits of logical units, and add a test case if the change fixes a bug or adds functionality.
2727
- Run the tests and make sure they pass (see below).
28-
- Add a changelog entry if the change is user-visible (see below).
28+
- If the change is user-visible, describe it in the pull request and leave its changelog entry to
29+
the maintainer (see below).
2930
- Make sure your commit messages are in the proper format (see below).
3031
- Push your changes to a topic branch in your fork of the repository.
3132
- Submit a pull request to the repo.
@@ -58,10 +59,15 @@ shapes of it at collection time and say what to do; `tests/_tiers.py` has the re
5859
Entries live in `docs/source/changelog/<version>.rst`, one file per version, listed newest-first in
5960
the toctree of `docs/source/changelog.rst`. That tree is the single source of the project's history.
6061

62+
**Pull requests for user-visible changes do not add their own bullet.** While a version is
63+
unreleased, its entry is written centrally by the maintainer once a change is ready to merge or has
64+
merged. Feature branches that each edit the same file conflict on every merge, so leave
65+
`docs/source/changelog/<version>.rst` and `CHANGELOG.md` out of the diff.
66+
6167
**`CHANGELOG.md` is generated — never edit it by hand.** `util/changelog_md.py` derives it from the
6268
newest entry alone, because its consumers (the `Create Release` workflow's release body and the
63-
source distribution) read Markdown rather than reStructuredText. Add your bullet to the `.rst`
64-
entry, then regenerate:
69+
source distribution) read Markdown rather than reStructuredText. The maintainer adds the bullet to the
70+
`.rst` entry, then regenerates:
6571

6672
```shell
6773
python util/changelog_md.py # rewrite CHANGELOG.md from the newest entry

‎tests/project/test_python_versions_update_1660.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,9 @@ def test_the_body_lists_what_the_owner_does_by_hand(self) -> None:
876876
body = module.fill_template((ROOT / module.TEMPLATE).read_text(encoding='utf-8'), description, 'failure')
877877
self.assertIn('- [x] `ci` — workflows or build tooling', body)
878878
self.assertEqual(body.count('- [x]'), 1)
879-
self.assertIn('regenerated `CHANGELOG.md`, if the change is user-visible — N/A — centralised in #657', body)
879+
self.assertIn('- [ ] Described the user-visible change above and left its [changelog entry]', body)
880+
self.assertIn('keeping `docs/source/changelog/` and `CHANGELOG.md` out of the diff, '
881+
'if the change is user-visible — N/A — centralised in #657', body)
880882
self.assertIn('### Description of your *pull request* and other information', body)
881883
self.assertNotIn('&emsp; Explanation of your', body)
882884
self.assertIn(f'| `3.11` | supported | KTLO | {plan["changes"][0]["reason"]} |', body)

‎util/update_python_versions.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ def fill_template(template: 'str', description: 'str', audit_outcome: 'str') ->
12981298
text = re.sub(r'(?m)^- \[ \] `ci`', '- [x] `ci`', template)
12991299
audit = {'success': 'passed', 'failure': 'failed'}.get(audit_outcome, audit_outcome)
13001300
text = re.sub(r'(?m)^(- \[ \] `make test` passes.*)$', rf'\1 -- not run; the audit {audit} (below)', text)
1301-
text = re.sub(r'(?m)^(- \[ \] Added a \[changelog entry\].*)$', r'\1 — N/A — centralised in #657', text)
1301+
text = re.sub(r'(?m)^(- \[ \] Described the user-visible change.*)$', r'\1 — N/A — centralised in #657', text)
13021302
placeholder = re.search(r'(?m)^&emsp; Explanation of your \*pull request\*.*$', text)
13031303
if placeholder is None:
13041304
return text.rstrip('\n') + '\n\n' + description + '\n'

0 commit comments

Comments
 (0)