Skip to content

Commit

Permalink
Allow custom filenames for changelog command
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea committed Sep 24, 2024
1 parent f433383 commit c3233f5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
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

0 comments on commit c3233f5

Please sign in to comment.