Skip to content

Commit

Permalink
Merge branch 'master' into uncommitted
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban authored Feb 13, 2022
2 parents 482cbea + a0a34d3 commit cb08709
Show file tree
Hide file tree
Showing 16 changed files with 202 additions and 38 deletions.
7 changes: 0 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ jobs:
- name: CPython 3.5
tox: py35
action: 3.5
- name: CPython 3.6
tox: py36
action: 3.6
- name: CPython 3.7
tox: py37
action: 3.7
Expand All @@ -88,9 +85,6 @@ jobs:
- name: PyPy 2.7
tox: pypy27
action: pypy-2.7
- name: PyPy 3.6
tox: pypy36
action: pypy-3.6
- name: PyPy 3.7
tox: pypy37
action: pypy-3.7
Expand Down Expand Up @@ -176,7 +170,6 @@ jobs:
needs:
- build
- test
- check
steps:
- uses: actions/checkout@v2

Expand Down
14 changes: 12 additions & 2 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,19 @@ Step-by-step

- Edit ``src/towncrier/_version.py`` such as ``__version__ = Version('towncrier', 19, 9, 0)`` to remove the release candidate indication.

- Return to the towncrier build step and continue.
- Manually update the NEWS.rst by removing the `.rcN` version and update the release date.

- If the final release has been completed, continue below.
- Disable the actual check for `tox -e check-newsfragment` so that you will have a green test run.

- Commit and push the changes to trigger the CI tests and make sure all are green.

- Tag as ``19.9.0`` and push the tag to the primary repository.

- This will result in another build which will publish to PyPI for the final release.

- Confirm the presence of the release on PyPI.

- If the final release has been completed, re-enable `tox -e check-newsfragment`.

- Increment the patch version by one and set to a development version.

Expand Down
23 changes: 23 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

.. towncrier release notes start
towncrier 21.9.0 (2022-02-04)
=============================

Features
--------

- towncrier --version` was added to the command line interface to show the product version. (`#339 <https://github.com/hawkowl/towncrier/issues/339>`_)
- Support Toml v1 syntax with tomli on Python 3.6+ (`#354 <https://github.com/hawkowl/towncrier/issues/354>`_)


Bugfixes
--------

- Stop writing title twice when ``title_format`` is specified. (`#346 <https://github.com/hawkowl/towncrier/issues/346>`_)
- Disable universal newlines when reading TOML (`#359 <https://github.com/hawkowl/towncrier/issues/359>`_)


Misc
----

- `#332 <https://github.com/hawkowl/towncrier/issues/332>`_, `#333 <https://github.com/hawkowl/towncrier/issues/333>`_, `#334 <https://github.com/hawkowl/towncrier/issues/334>`_, `#338 <https://github.com/hawkowl/towncrier/issues/338>`_


towncrier 21.3.0 (2021-04-02)
=============================

Expand Down
14 changes: 14 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,17 @@ Furthermore, you can add your own fragment types using:
directory = "deprecation"
name = "Deprecations"
showcontent = true
Automatic pull request checks
-----------------------------

To check if a feature branch adds at least one news fragment, run::

towncrier check

By default this compares the current branch against ``origin/master``. You can use ``--compare-with`` if the trunk is named differently::

towncrier check --compare-with origin/main

The check is automatically skipped when the main news file is modified inside the branch as this signals a release branch that is expected to not have news fragments.
14 changes: 9 additions & 5 deletions src/towncrier/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import pkg_resources

if sys.version_info >= (3, 6):
from tomli import load as _toml_load
import tomli
else:
from toml import load as _toml_load
tomli = None
import toml

from collections import OrderedDict

Expand Down Expand Up @@ -74,9 +75,12 @@ def load_config(directory):


def load_config_from_file(directory, config_file):

with io.open(config_file, "r", encoding="utf8") as conffile:
config = _toml_load(conffile)
if tomli:
with io.open(config_file, "rb") as conffile:
config = tomli.load(conffile)
else:
with io.open(config_file, "r", encoding="utf8", newline="") as conffile:
config = toml.load(conffile)

return parse_toml(directory, config)

Expand Down
2 changes: 1 addition & 1 deletion src/towncrier/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@

from incremental import Version

__version__ = Version("towncrier", 21, 3, 1, dev=0)
__version__ = Version("towncrier", 21, 9, 1, dev=0)
__all__ = ["__version__"]
1 change: 0 additions & 1 deletion src/towncrier/_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def append_to_newsfile(
if start_string:
f.write((u"\n\n" + start_string + u"\n").encode("utf8"))

f.write(top_line.encode("utf8"))
f.write(content.encode("utf8"))
if existing_content:
if existing_content[0]:
Expand Down
7 changes: 6 additions & 1 deletion src/towncrier/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __main(comparewith, directory, config):
raise

if not files_changed:
click.echo("On trunk, or no diffs, so no newsfragment required.")
click.echo("On {} branch, or no diffs, so no newsfragment required.".format(comparewith))
sys.exit(0)

files = {
Expand All @@ -52,6 +52,11 @@ def __main(comparewith, directory, config):
click.echo("{}. {}".format(n, change))
click.echo("----")

news_file = os.path.normpath(os.path.join(base_directory, config["filename"]))
if news_file in files:
click.echo("Checks SKIPPED: news file changes detected.")
sys.exit(0)

if config.get("directory"):
fragment_base_directory = os.path.abspath(config["directory"])
fragment_directory = None
Expand Down
Empty file.
1 change: 0 additions & 1 deletion src/towncrier/newsfragments/333.misc.rst

This file was deleted.

1 change: 0 additions & 1 deletion src/towncrier/newsfragments/334.misc.rst

This file was deleted.

5 changes: 5 additions & 0 deletions src/towncrier/newsfragments/337.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Make the check subcommand succeed for branches that change the news file

This should enable the ``check`` subcommand to be used as a CI lint step and
not fail when a pull request only modifies the configured news file (i.e. when
the news file is being assembled for the next release).
1 change: 0 additions & 1 deletion src/towncrier/newsfragments/338.misc.rst

This file was deleted.

1 change: 0 additions & 1 deletion src/towncrier/newsfragments/339.feature.rst

This file was deleted.

1 change: 0 additions & 1 deletion src/towncrier/newsfragments/354.feature.rst

This file was deleted.

Loading

0 comments on commit cb08709

Please sign in to comment.