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

#55 - Chapter line formatting - authors #74

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
40a4ee2
#55 - Chapter line formatting - authors
miroslavpojer Sep 25, 2024
c58d859
Merge branch 'refs/heads/master' into feature/55-Chapter-line-formatt…
miroslavpojer Sep 30, 2024
ec9eb91
- Introduced logic and example adding prefix strings as part of keyword.
miroslavpojer Sep 30, 2024
17bfaf7
- Fixed wrong keywords. Debug.
miroslavpojer Oct 1, 2024
7885040
- Remove unexpected import.
miroslavpojer Oct 1, 2024
f8e90f8
- Fixes from manual test.
miroslavpojer Oct 1, 2024
9be86e6
- Fixes from manual test.
miroslavpojer Oct 1, 2024
946368d
- Fixes from manual test.
miroslavpojer Oct 1, 2024
eb325a5
- Fixes from manual test.
miroslavpojer Oct 1, 2024
9156996
- Fixes from manual test.
miroslavpojer Oct 1, 2024
3c6bce8
- Fixes from manual test.
miroslavpojer Oct 1, 2024
8585cf6
- Fixes from manual test.
miroslavpojer Oct 1, 2024
ffc4fc6
- Fixes from manual test.
miroslavpojer Oct 1, 2024
c0a283e
- Fixes from manual test.
miroslavpojer Oct 1, 2024
1e8b6bc
- Fixes from manual test.
miroslavpojer Oct 1, 2024
80952d8
- Fixes from manual test.
miroslavpojer Oct 1, 2024
ad79944
- Fixes from manual test.
miroslavpojer Oct 1, 2024
67f1961
- Fixes from manual test.
miroslavpojer Oct 1, 2024
291dd9c
- Fixes from manual test.
miroslavpojer Oct 1, 2024
daa4b67
- Fixes from manual test.
miroslavpojer Oct 1, 2024
f6e7647
- Fixes from manual test.
miroslavpojer Oct 1, 2024
f83b490
- Fixes from manual test.
miroslavpojer Oct 1, 2024
4e877b2
- Fixes from manual test.
miroslavpojer Oct 1, 2024
d16adb0
- Fixes from manual test.
miroslavpojer Oct 1, 2024
5cc9c12
- Fixes from manual test.
miroslavpojer Oct 1, 2024
81dfaec
- Fixes from manual test.
miroslavpojer Oct 1, 2024
d42079a
- Fixes from manual test.
miroslavpojer Oct 1, 2024
5e5d595
- Fixes from manual test.
miroslavpojer Oct 1, 2024
55c728b
- Fixes from manual test.
miroslavpojer Oct 1, 2024
ea98398
- Fixes from manual test.
miroslavpojer Oct 1, 2024
37bd927
- Fixes from manual test.
miroslavpojer Oct 1, 2024
3d3c803
- Fixes from manual test.
miroslavpojer Oct 1, 2024
ba570b3
- Fixes from manual test.
miroslavpojer Oct 1, 2024
105fffd
- Fixes from manual test.
miroslavpojer Oct 1, 2024
72609cc
- Fixes from manual test.
miroslavpojer Oct 1, 2024
d1e4d9a
- Fixes from manual test.
miroslavpojer Oct 1, 2024
7ced5ad
- Fixes from manual test.
miroslavpojer Oct 1, 2024
52ceae9
- Fixes from manual test.
miroslavpojer Oct 1, 2024
cd361e7
- Fixes from manual test.
miroslavpojer Oct 1, 2024
d32f425
- Fixes from manual test.
miroslavpojer Oct 1, 2024
9ea0f48
- Fixes from manual test.
miroslavpojer Oct 1, 2024
7bc3eb6
- Fixes from manual test.
miroslavpojer Oct 1, 2024
bdc1872
- Implemented support for developers and contributors.
miroslavpojer Oct 4, 2024
3285283
- The Record class logic split to 4 files.
miroslavpojer Oct 7, 2024
c118375
- Add support for row format for direct commits.
miroslavpojer Oct 7, 2024
d572654
- Fix commit row format.
miroslavpojer Oct 7, 2024
b525e29
- Pylint and pytest scope reduced. Tests files excluded.
miroslavpojer Oct 7, 2024
4bd8460
- Remove no more supported feature. In new version this behavior is d…
miroslavpojer Oct 8, 2024
0d2d326
- Applied black.
miroslavpojer Oct 8, 2024
abdce26
- Fixed problem with few space in bullet list.
miroslavpojer Oct 8, 2024
20d19ae
- Fixed unit tests for utils.py.
miroslavpojer Oct 8, 2024
e6428d7
- Fixed unit tests for utils directory.
miroslavpojer Oct 8, 2024
f9d4e6c
Merge branch 'refs/heads/master' into feature/55-Chapter-line-formatt…
miroslavpojer Oct 10, 2024
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
110 changes: 0 additions & 110 deletions .github/workflows/release_notes_comments_migration.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ unsafe-load-any-extension=no
# In verbose mode, extra non-checker-related info will be displayed.
#verbose=

[MASTER]

ignore-paths=tests

[BASIC]

Expand Down
117 changes: 88 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
- [Usage Example](#usage-example)
- [Features](#features)
- [Built-in](#built-in)
- [Release Notes Extraction Process](#release-notes-extraction-process)
- [Release Notes Support](#release-notes-support)
- [Handling Issue Mentioned By Multiple PRs](#handling-issue-mentioned-by-multiple-prs)
- [No Release Notes Found](#no-release-notes-found)
- [Issue, Pull Request or Commit Row formatting](#issue-pull-request-or-commit-row-formatting)
- [Supported row format keywords](#supported-row-format-keywords)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some bugs, I found during review (README.md), that are already merged. Please find this comment as a block of suggestions, that may occur on more than just one place.

  • Please reconsider and make a statement about what levels of headers you want to visualize in POC. In my opinion here you go too deep visualizing h5. There are many h3 in inputs section, which are not seen in PoC. It doesn't look compact.
  • This h5 doesn't really have to be extra header at all. Because there is just one header in the section at the time.
  • I think that best practice is to have a new header level only, whenever you need @ or more lower level of headings. Easier to see in practice. You have h2 (## Outputs) and then you have just one h3 (### Supported Row Types) and after 3 times h4. I don't see a reason to have this one h3. There is not a single sentence anyway.
  • The same issue in h5 (##### Supported row format keywords). It is not needed IMHO.
  • look at line 99 = ### Feature controls, it should be higher level of a header based on the context around.
  • look at line 150 = #### Default. I am suggesting to change it to Default, since there is no need to have it as a header. Same at line 167.
  • after Black Expected Output example there is an extra blank line
  • add information, that pylint and black tool exclude tests/ file

Copy link
Collaborator Author

@miroslavpojer miroslavpojer Oct 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part will be reworked, including a change of chapter meaning.
This text will not be reused.

Keeping not Resolved to check again after new data structure will be implemented.

- [Contributors Mention](#contributors-mention)
- [Handling Multiple PRs](#handling-multiple-prs)
- [Handling Issue Mentioned By Multiple PRs](#handling-issue-mentioned-by-multiple-prs)
- [No Release Notes Found](#no-release-notes-found)
- [Select start date for closed issues and PRs](#select-start-date-for-closed-issues-and-prs)
- [Enable skipping of release notes for specific issues using label](#enable-skipping-of-release-notes-for-specific-issues-using-label)
Expand Down Expand Up @@ -54,12 +58,12 @@ 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} {assignee} {implemented-by} {contributed-by}"`

### `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.
- **Required**: No
- **Default**: `#{number} _{title}_"`
- **Default**: `#{number} _{title}_ {assignee} {implemented-by} {contributed-by}`

### `row-format-link-pr`
- **Description**: If defined `true`, the PR row will begin with a `"PR: "` string. Otherwise, no prefix will be added.
Expand Down Expand Up @@ -104,17 +108,35 @@ Generate Release Notes action is dedicated to enhance the quality and organizati
- **Required**: No
- **Default**: true (Empty chapters are printed.)

### `chapters-to-pr-without-issue`
- **Description**: Set it to false to avoid the application of custom chapters for PRs without linked issues.
- **Required**: No
- **Default**: true (Custom chapters are applied to PRs without linked issues.)


## Outputs
The output of the action is a markdown string containing the release notes for the specified tag. This string can be used in subsequent steps to publish the release notes to a file, create a GitHub release, or send notifications.

See the [example of output](./examples/output_example.md).

### Supported Row Types
#### Issue Row
An issue row may have multiple pull requests linked to it. These pull requests are associated using GitHub-supported keywords like closes, fixes, or resolves.

**Example**
- #33 _Example bugfix_ in [#44](https://github.com/absa-group/living-doc-example-project/pull/44), [#36](https://github.com/absa-group/living-doc-example-project/pull/36), [#35](https://github.com/absa-group/living-doc-example-project/pull/35), [#34](https://github.com/absa-group/living-doc-example-project/pull/34) assigned to @miroslavpojer developed by @miroslavpojer co-authored by Saša Zejnilović <[email protected]>
miroslavpojer marked this conversation as resolved.
Show resolved Hide resolved
- Another solved typos. Hello from second RLS notes comment.
- Solved some typos.

#### Pull Request Row
A pull request row represents one PR made against the repository. This pull request does not mention any issues.

**Example**
- PR: #41 _Initial commit._ assigned to @miroslavpojer developed by @miroslavpojer
- Test release notes nr1
- Test release notes nr2

#### Direct Commit Row
A direct commit row represents a commit that is not tied to any pull request or issue. This commit is not associated with any pull request.

**Example**
- Commit: fbe8e558f914cd58d8e7aab8c7d0c77f934aa707 developed by @miroslavpojer

## Usage Example

### Prerequisites
Expand Down Expand Up @@ -165,37 +187,67 @@ 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} {assignee} {developed-by} {co-authored-by}'
row-format-pr: '#{number} _{title}_ {assignee} {developed-by} {co-authored-by}'
row-format-link-pr: true
```

## Features
### Built-in
#### Release Notes Extraction Process

This action requires that your GitHub issues include comments with specific release notes. Here's how it works:
#### Release Notes Support
This action enables GitHub pull requests to include a dedicated section for release notes in its description, making it easier for maintainers to track changes and updates.

**Extraction Method**:
- The action scans through comments on each closed issue since the last release. It identifies comments that follow the specified format and extracts the content as part of the release notes.
- The time considered for the previous release is based on its creation time. This means that the action will look for issues closed after the creation time of the most recent release to ensure that all relevant updates since that release are included.

**Comment Format**
- For an issue's contributions to be included in the release notes, it must contain a comment starting with "Release Notes" followed by the note content. This comment is typically added by the contributors.
- Here is an example of the content for a 'Release Notes' string, which is not case-sensitive:
- **Format:** The section must begin with the title `Release Notes:`, followed by the release notes in bullet points.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious, why you are not using re = /release notes/i anymore? We can discuss this in some of our calls.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Release note can be part of the text. I have selected a value that should represent chapter name.

- **Example:** Here is an example of how to structure the release notes (case-sensitive):
```
Release Notes
Release Notes:
- This update introduces a new caching mechanism that improves performance by 20%.
```
- Using `-` as a bullet point for each note is the best practice. The Markdown parser will automatically convert it to a list.
- These comments are not required for action functionality. If an issue does not contain a "Release Notes" comment, it will be marked accordingly in the release notes. This helps maintainers quickly identify which issues need attention for documentation.
- **Best Practice:** Use `-` for bullet points. The Markdown parser will automatically format them as a list.
- **Optional:** Including release notes is not mandatory for the action of this GH action.

#### Contributors Mention
Along with the release note content, the action also gathers a list of contributors for each issue. This includes issue assignees and authors of linked pull requests' commits, providing acknowledgment for their contributions in the release notes.
The action scans pull request descriptions for the `Release Notes:` section and extracts any content that follows the specified format.

#### Handling Multiple PRs
If an issue is linked to multiple PRs, the action fetches and aggregates contributions from all linked PRs.
#### Handling Issue Mentioned By Multiple PRs
If an issue is linked from multiple PRs, the action fetches and aggregates developers and contributions from all linked PRs.

#### 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.
If no valid `Release Notes:` section is found in a pull request description, it will be mentioned in dedicated service chapters. This helps maintainers quickly identify which pull request need attention for documentation.

#### Issue, Pull Request or Commit Row formatting
Format of the different row types can be customized. The placeholders are case-sensitive. Each row type supports different set of keywords.

##### Supported row format keywords
- **Issue & Pull Request**
- `{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:
- _Example:_ `#{number} _{title}_ {pull-requests}` => "[#43]() _title_ in [#PR1](), [#PR2](), [#PR3]()"
- Not used in PR row format. Pull Request type already define single PR.
- `{assingee}`:
- Issue or PR assignee. Adds a login of assignees in the row with `assigned to` prefix:
- `#{number} _{title}_ {assignee}` => "[#43]() _title_ implemented by @login1"
- `{assignees}`:
- Issue or PR assignees. Adds a list of assignees logins in the row with `assigned to` prefix:
- `#{number} _{title}_ {assignees}` => "[#43]() _title_ implemented by @login1, @login2"
- This is alternative representation of multiple assignees provided by GitHub.
- `{developed-by}`:
- List of PR developer(s) login(s). Adds a login of commit authors for PR(s) in the row with `developed by` prefix:
- `#{number} _{title}_ {developed-by}` => "[#43]() _title_ developed by @login1"
- `{co-authored-by}`:
- List of PR contributors. Adds a login of contributors in the row with `co-authored by` prefix:
- `#{number} _{title}_ {co-authored-by}` => "[#43]() _title_ co-authored by @login1 @login2"
- Co-authors are detected in PR commit messages by detection of GitHub supported trailer `Co-authored-by`.
- **Commit**
- `{sha}`:
- Commit SHA.
- `{author}`:
- Commit author login.
- `{co-authors}`:
- List of commit contributors. Co-authors are detected in commit messages by detection of GitHub supported trailer `Co-authored-by`.

### 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 Expand Up @@ -350,6 +402,12 @@ pytest tests/

This will execute all tests located in the tests directory and generate a code coverage report.
miroslavpojer marked this conversation as resolved.
Show resolved Hide resolved

TODO: add another example for partial run
MobiTikula marked this conversation as resolved.
Show resolved Hide resolved
pytest tests/release_notes_generator/utils/test_utils.py

debug only - how to run measuremnt on isolated test set
miroslavpojer marked this conversation as resolved.
Show resolved Hide resolved
pytest --cov=. tests/release_notes_generator/utils/test_utils.py --cov-fail-under=80 --cov-report=html

## Code Coverage

Code coverage is collected using pytest-cov coverage tool. To run the tests and collect coverage information, use the following command:
Expand All @@ -358,6 +416,8 @@ Code coverage is collected using pytest-cov coverage tool. To run the tests and
pytest --cov=release_notes_generator --cov-report html tests/
miroslavpojer marked this conversation as resolved.
Show resolved Hide resolved
```



miroslavpojer marked this conversation as resolved.
Show resolved Hide resolved
See the coverage report on the path:

```
Expand All @@ -382,7 +442,6 @@ export INPUT_WARNINGS="true"
export INPUT_PUBLISHED_AT="true"
export INPUT_SKIP_RELEASE_NOTES_LABEL="ignore-in-release"
export INPUT_PRINT_EMPTY_CHAPTERS="true"
export INPUT_CHAPTERS_TO_PR_WITHOUT_ISSUE="true"
export INPUT_VERBOSE="true"

# CI in-build variables
Expand Down
23 changes: 14 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,26 +47,30 @@ inputs:
description: 'Print chapters even if they are empty.'
required: false
default: 'true'
chapters-to-pr-without-issue:
description: 'Apply custom chapters for PRs without linked issues.'
required: false
default: 'true'
verbose:
description: 'Print verbose logs.'
required: false
default: 'false'
row-format-issue:
description: 'Format of the issue row in the release notes. Available placeholders: {link}, {title}, {pull-requests}. Placeholders are case-insensitive.'
description: 'Format of the issue row in the release notes. Available placeholders: {number}, {title}, {pull-requests}, {assignee}, {assignees}, {developed-by}, {co-authored-by}. Placeholders are case-insensitive.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Placeholders are case-insensitive. is this true? In README.md there is written that placeholders are case-sensitive instead.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are case-sensitive. It is already written in README. I have checked it, and I did not find the wrong description.
See minor change related to this topic - commit 9e11d4d.

required: false
default: '#{number} _{title}_ in {pull-requests}'
default: '#{number} _{title}_ {pull-requests} {assignee} {developed-by} {co-authored-by}'
row-format-pr:
description: 'Format of the pr row in the release notes. Available placeholders: {link}, {title}, {pull-requests}. Placeholders are case-insensitive.'
description: 'Format of the pr row in the release notes. Available placeholders: {number}, {title}, {assignee}, {assignees}, {developed-by}, {co-authored-by}. Placeholders are case-insensitive.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are case-sentisitive.

required: false
default: '#{number} _{title}_ {assignee} {developed-by} {co-authored-by}'
row-format-commit:
description: 'Format of the commit row in the release notes. Available placeholders: {sha}, {author}, {co-authored-by}. Placeholders are case-insensitive.'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same answer like above.

required: false
default: '#{number} _{title}_'
default: '{sha} {author} {co-authored-by}'
row-format-link-pr:
description: 'Add prefix "PR:" before link to PR when not linked an Issue.'
required: false
default: 'true'
row-format-link-commit:
description: 'Add prefix "Commit:" before link to direct commit.'
required: false
default: 'true'

outputs:
release-notes:
Expand Down Expand Up @@ -118,12 +122,13 @@ runs:
INPUT_PUBLISHED_AT: ${{ inputs.published-at }}
INPUT_SKIP_RELEASE_NOTES_LABEL: ${{ inputs.skip-release-notes-label }}
INPUT_PRINT_EMPTY_CHAPTERS: ${{ inputs.print-empty-chapters }}
INPUT_CHAPTERS_TO_PR_WITHOUT_ISSUE: ${{ inputs.chapters-to-pr-without-issue }}
INPUT_VERBOSE: ${{ inputs.verbose }}
INPUT_GITHUB_REPOSITORY: ${{ github.repository }}
INPUT_ROW_FORMAT_ISSUE: ${{ inputs.row-format-issue }}
INPUT_ROW_FORMAT_PR: ${{ inputs.row-format-pr }}
INPUT_ROW_FORMAT_COMMIT: ${{ inputs.row-format-commit }}
INPUT_ROW_FORMAT_LINK_PR: ${{ inputs.row-format-link-pr }}
INPUT_ROW_FORMAT_LINK_COMMIT: ${{ inputs.row-format-link-commit }}
run: |
python ${{ github.action_path }}/main.py
shell: bash
Loading
Loading