Skip to content

Commit 46945b3

Browse files
authored
chore(librarian): add pypi anchor to CHANGELOG.md (#14796)
This PR adds the pypi anchor to the `CHANGELOG.md` file and ensures that both `CHANGELOG.md` and `docs/CHANGELOG.md`, if it exists, are updated in release-init.
1 parent cbf83c1 commit 46945b3

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

.generator/cli.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,13 @@ def _create_new_changelog_for_library(library_id: str, output: str):
233233
package_changelog_path = f"{output}/packages/{library_id}/CHANGELOG.md"
234234
docs_changelog_path = f"{output}/packages/{library_id}/docs/CHANGELOG.md"
235235

236+
changelog_content = f"# Changelog\n\n[PyPI History][1]\n\n[1]: https://pypi.org/project/{library_id}/#history\n"
237+
236238
os.makedirs(os.path.dirname(package_changelog_path), exist_ok=True)
237-
_write_text_file(package_changelog_path, "# Changelog\n")
239+
_write_text_file(package_changelog_path, changelog_content)
238240

239241
os.makedirs(os.path.dirname(docs_changelog_path), exist_ok=True)
240-
_write_text_file(docs_changelog_path, "# Changelog\n")
242+
_write_text_file(docs_changelog_path, changelog_content)
241243

242244

243245
def handle_configure(

.generator/test_cli.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,8 +330,9 @@ def test_create_new_changelog_for_library(mocker):
330330
assert mock_makedirs.call_count == 2
331331

332332
# Check that the files were "written" with the correct content
333-
mock_write_text_file.assert_any_call(package_changelog_path, "# Changelog\n")
334-
mock_write_text_file.assert_any_call(docs_changelog_path, "# Changelog\n")
333+
changelog_content = f"# Changelog\n\n[PyPI History][1]\n\n[1]: https://pypi.org/project/{library_id}/#history\n"
334+
mock_write_text_file.assert_any_call(package_changelog_path, changelog_content)
335+
mock_write_text_file.assert_any_call(docs_changelog_path, changelog_content)
335336
assert mock_write_text_file.call_count == 2
336337

337338

0 commit comments

Comments
 (0)