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

changelog: Reference multiple issues/pull requests for a single entry #2697

Merged
merged 1 commit into from
Feb 20, 2020
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
4 changes: 4 additions & 0 deletions .changelog/2697.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
changelog: Reference multiple issues/pull requests for a single entry

For more details, see the description in [Change Log fragments](
.changelog/README.md#multiple-issues--pull-requests-for-a-single-fragment).
21 changes: 21 additions & 0 deletions .changelog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,27 @@ Example file names:
- `3456.bugfix.1.md`,
- `3456.bugfix.2.md`.

## Multiple issues / pull requests for a single fragment

Sometimes referencing multiple issues or pull requests in a Change Log
fragment is desired.

For example:

- when a single Change Log fragment describes a change that resolves multiple
issues, or
- when a sub-sequent issue / pull request augments a change that already has a
corresponding Change Log fragment.

In this case, you need to augment (if necessary) the original Change Log
fragment (e.g. `1234.feature.md`) and copy it to a new file which has the new
issue or pull request number in its name (e.g. `1356.feature.md`).
The [towncrier] tool will automatically detect a duplicate Change Log fragment
and combine issue / pull request numbers in a single Change Log entry.

_NOTE: You can repeat this process to refer to as many issues / pull requests
as needed._

## Render Change Log preview

To get a preview of how your change (and other changes queued up in this
Expand Down
5 changes: 3 additions & 2 deletions .changelog/template.md.j2
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@

{% for text, values in sections[section][category].items() %}
{% set lines = text.splitlines() %}
{% set referenced_issues = "(" + values | join(',\n ') + ")" %}
{% if lines | length > 2 and lines[1] == "" %}
- {{ lines[0] }}
({{ values | join(', ') }})
{{ referenced_issues }}

{{ lines[2:] | join('\n') }}
{% else %}
- {{ text }}
({{ values | join(', ') }})
{{ referenced_issues }}
{% endif %}
{% if not loop.last %}

Expand Down