Skip to content

Commit

Permalink
Merge pull request #2697 from oasislabs/tjanez/changelog-improvements
Browse files Browse the repository at this point in the history
changelog: Reference multiple issues/pull requests for a single entry
  • Loading branch information
tjanez authored Feb 20, 2020
2 parents c00b1b7 + b6f5eba commit 5afa3e6
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
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

0 comments on commit 5afa3e6

Please sign in to comment.