Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom filenames for changelog command #247

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,11 @@ basic commands:

If a [pytest](https://docs.pytest.org/en/stable/) configuration file is found, a
`test` command will be exposed that runs `pytest`.

## changelog (github)

`changelog` command will produce a `CHANGELOG.md` file based on Github Releases.
You can define `CHANGELOG_FILE` environment variable to make it generate the
file in a different location.

This command is available only when `gh` command line utility is installed.
2 changes: 2 additions & 0 deletions samples/integration/nox.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ tests(python='3.11', tox_version='<4')
tests(python='3.11', tox_version='latest')
tests(python='3.12', tox_version='<4')
tests(python='3.12', tox_version='latest')
tests(python='3.13', tox_version='<4')
tests(python='3.13', tox_version='latest')
tests(python='3.8', tox_version='<4')
tests(python='3.8', tox_version='latest')
tests(python='3.9', tox_version='<4')
Expand Down
2 changes: 0 additions & 2 deletions samples/integration/typeshed.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ alerts
changelog
create_baseline_stubs
drafts
generate_proto_stubs
lint
prs
sync_tensorflow_protobuf_stubs
3 changes: 2 additions & 1 deletion src/mk/tools/pre.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ def changelog(self) -> None:
result = result.rstrip("\r\n") + "\n"
result = result.replace("\r\n", "\n")
result = re.sub(r"\n{3,}", "\n\n", result, re.MULTILINE)
with open("CHANGELOG.md", "w", encoding="utf-8") as f:
filename = os.environ.get("CHANGELOG_FILE", "CHANGELOG.md")
with open(filename, "w", encoding="utf-8") as f:
f.write(result)
logging.info("Wrote CHANGELOG.md")

Expand Down
Loading