Skip to content

Commit

Permalink
#55 - Chapter line formatting - authors
Browse files Browse the repository at this point in the history
- Add limitation to avoid of usage black to tests.
- Removed workflow copying Release notes from PR to Issue as no more supported.
- Updated README.md to show example of row formatting as build-in feature and provide list of supported keywords.
  • Loading branch information
miroslavpojer committed Sep 25, 2024
1 parent 178819b commit 40a4ee2
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 118 deletions.
110 changes: 0 additions & 110 deletions .github/workflows/release_notes_comments_migration.yml

This file was deleted.

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Generate Release Notes action is dedicated to enhance the quality and organizati
### `row-format-issue`
- **Description**: The format of the row for the issue in the release notes. The format can contain placeholders for the issue `number`, `title`, and issues `pull-requests`. The placeholders are case-sensitive.
- **Required**: No
- **Default**: `#{number} _{title}_ in {pull-requests}"`
- **Default**: `#{number} _{title}_ {pull-requests}"`

### `row-format-pr`
- **Description**: The format of the row for the PR in the release notes. The format can contain placeholders for the PR `number`, `title`, and PR `pull-requests`. The placeholders are case-sensitive.
Expand Down Expand Up @@ -166,6 +166,9 @@ Add the following step to your GitHub workflow (in example are used non-default
warnings: false
print-empty-chapters: false
chapters-to-pr-without-issue: false
row-format-issue: '#{number} _{title}_ {pull-requests}"'
row-format-pr: '#{number} _{title}_"'
row-format-link-pr: true
```
## Features
Expand Down Expand Up @@ -197,6 +200,16 @@ If an issue is linked to multiple PRs, the action fetches and aggregates contrib
#### No Release Notes Found
If no valid "Release Notes" comment is found in an issue, it will be marked accordingly. This helps maintainers quickly identify which issues need attention for documentation.

#### Row formatting
Format of the row for the issue and PR in the release notes can be customized. The placeholders are case-sensitive.

**Supported row format keywords:**
- `{number}`: Issue or PR number.
- `{title}`: Issue or PR title.
- `{pull-requests}`: List of PRs linked to the issue. Adds a list of PRs linked to the issue in the row with `in` prefix:
- `#{number} _{title}_ {pull-requests}` => "[#43]() _title_ in [#PR1](), [#PR2](), [#PR3]()"
- Not used in PR row format. See default value.

### Select start date for closed issues and PRs
By set **published-at** to true the action will use the `published-at` timestamp of the latest release as the reference point for searching closed issues and PRs, instead of the `created-at` date. If first release, repository creation date is used.

Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ inputs:
row-format-issue:
description: 'Format of the issue row in the release notes. Available placeholders: {link}, {title}, {pull-requests}. Placeholders are case-insensitive.'
required: false
default: '#{number} _{title}_ in {pull-requests}'
default: '#{number} _{title}_ {pull-requests} {authors}'
row-format-pr:
description: 'Format of the pr row in the release notes. Available placeholders: {link}, {title}, {pull-requests}. Placeholders are case-insensitive.'
required: false
default: '#{number} _{title}_'
default: '#{number} _{title}_ {authors}'
row-format-link-pr:
description: 'Add prefix "PR:" before link to PR when not linked an Issue.'
required: false
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[tool.black]
line-length = 120
target-version = ['py311']
force-exclude = '''test'''
2 changes: 1 addition & 1 deletion release_notes_generator/action_inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def get_row_format_issue() -> str:
"""
Get the issue row format for the release notes.
"""
return get_action_input(ROW_FORMAT_ISSUE, "#{number} _{title}_ in {pull-requests}").strip()
return get_action_input(ROW_FORMAT_ISSUE, "#{number} _{title}_ {pull-requests}").strip()

@staticmethod
def get_row_format_pr() -> str:
Expand Down
2 changes: 1 addition & 1 deletion release_notes_generator/model/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def to_chapter_row(self) -> str:
else:
format_values["number"] = self.__gh_issue.number
format_values["title"] = self.__gh_issue.title
format_values["pull-requests"] = self.pr_links if len(self.__pulls) > 0 else ""
format_values["pull-requests"] = f"in {self.pr_links}" if len(self.__pulls) > 0 else ""
format_values["authors"] = self.authors if self.authors is not None else ""
format_values["contributors"] = self.contributors if self.contributors is not None else ""

Expand Down
6 changes: 3 additions & 3 deletions tests/release_notes/test_release_notes_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ def __init__(self, name):
"""

RELEASE_NOTES_DATA_SERVICE_CHAPTERS_CLOSED_ISSUE_NO_PR_NO_USER_LABELS = """### Closed Issues without Pull Request ⚠️
- #121 _Fix the bug_ in
- #121 _Fix the bug_
### Closed Issues without User Defined Labels ⚠️
- 🔔 #121 _Fix the bug_ in
- 🔔 #121 _Fix the bug_
#### Full Changelog
http://example.com/changelog
Expand Down Expand Up @@ -224,7 +224,7 @@ def __init__(self, name):
"""

RELEASE_NOTES_DATA_CLOSED_ISSUE_NO_PR_WITH_USER_LABELS = """### Closed Issues without Pull Request ⚠️
- #121 _Fix the bug_ in
- #121 _Fix the bug_
#### Full Changelog
http://example.com/changelog
Expand Down

0 comments on commit 40a4ee2

Please sign in to comment.