-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add Statistics & Anti-game chapters to release notes #305
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
Open
miroslavpojer
wants to merge
2
commits into
master
Choose a base branch
from
feature/184-New-service-check---skip-label-stats
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| # Feature: Statistics & Anti-game Chapters | ||
|
|
||
| ## Purpose | ||
| Surface skip-label usage statistics so that maintainers can audit who and what is being excluded from release notes via skip labels. Discourages overuse of the `skip-release-notes` label by making the practice visible. | ||
|
|
||
| ## How It Works | ||
| - Enabled when input `show-stats-chapters` is `true` (default). When `false`, stats chapters are omitted entirely. | ||
| - Iterates **all** records, including those with `skip=True`, to compute totals and skip counts. | ||
| - The chapter is only rendered when at least one record in the release window carries a skip label. If nothing was skipped, the entire section is omitted regardless of `print-empty-chapters`. | ||
| - Honors `print-empty-chapters` for individual sub-sections: when `true` (default), sub-sections where no records were skipped but records exist are still shown (with a zero skipped count). When `false`, only sub-sections with at least one skipped record are rendered. | ||
| - Rendered after Service Chapters (or after Custom Chapters if `warnings: false`). | ||
|
|
||
| ### Sub-sections | ||
|
|
||
| The chapter contains four fixed sub-sections in the following order: | ||
|
|
||
| #### 1. PR Authors | ||
| Compares PR authors and their usage of the skip label. | ||
|
|
||
| | Column | Description | | ||
| |--------|-------------| | ||
| | Author | PR author (`@login`) or `(no author)` | | ||
| | Total PRs | All PRs by that author | | ||
| | Skipped PRs | PRs by that author carrying a skip label | | ||
|
|
||
| #### 2. Issue Authors / Assignees | ||
| Compares issue authors and assignees and their usage of the skip label. A person appearing as both author and assignee of different issues is counted once per issue involvement. | ||
|
|
||
| | Column | Description | | ||
| |--------|-------------| | ||
| | Author / Assignee | Person (`@login`) or `(no author)` | | ||
| | Total Issues | Issues where this person is author or assignee | | ||
| | Skipped Issues | Skipped issues where this person is author or assignee | | ||
|
|
||
| #### 3. Issue Labels | ||
| Compares non-skip labels on issues and their usage of the skip label. | ||
|
|
||
| | Column | Description | | ||
| |--------|-------------| | ||
| | Label | Non-skip label on the issue, or `(no label)` | | ||
| | Total Issues | Issues carrying that label | | ||
| | Skipped Issues | Skipped issues carrying that label | | ||
|
|
||
| #### 4. PR Labels | ||
| Compares non-skip labels on PRs and their usage of the skip label. | ||
|
|
||
| | Column | Description | | ||
| |--------|-------------| | ||
| | Label | Non-skip label on the PR, or `(no label)` | | ||
| | Total PRs | PRs carrying that label | | ||
| | Skipped PRs | Skipped PRs carrying that label | | ||
|
|
||
| All sub-sections sort rows by skipped count descending, then by name ascending. Skip-label names are excluded from label buckets. | ||
|
|
||
| ## Configuration | ||
| ```yaml | ||
| - name: Generate Release Notes | ||
| id: release_notes_scrapper | ||
| uses: AbsaOSS/generate-release-notes@v1 | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| with: | ||
| tag-name: "v2.0.0" | ||
| chapters: | | ||
| - {"title": "Features", "label": "feature"} | ||
| - {"title": "Fixes", "label": "bug"} | ||
| show-stats-chapters: true # enabled by default | ||
| print-empty-chapters: true # show sub-sections even with zero skips | ||
| ``` | ||
|
|
||
| To disable: | ||
| ```yaml | ||
| show-stats-chapters: false | ||
| ``` | ||
|
|
||
| ## Example Result | ||
| ```markdown | ||
| ### Skip Release Notes Label Usage ⚠️ | ||
| #### PR Authors | ||
| | Author | Total PRs | Skipped PRs | | ||
| |--------|-----------|-------------| | ||
| | @alice | 5 | 3 | | ||
| | @bob | 2 | 0 | | ||
|
|
||
| #### Issue Authors / Assignees | ||
| | Author / Assignee | Total Issues | Skipped Issues | | ||
| |--------------------|--------------|----------------| | ||
| | @alice | 6 | 3 | | ||
| | @bob | 4 | 2 | | ||
|
|
||
| #### Issue Labels | ||
| | Label | Total Issues | Skipped Issues | | ||
| |-------|--------------|----------------| | ||
| | bug | 6 | 4 | | ||
| | enhancement | 3 | 1 | | ||
| | (no label) | 2 | 2 | | ||
|
|
||
| #### PR Labels | ||
| | Label | Total PRs | Skipped PRs | | ||
| |-------|-----------|-------------| | ||
| | bug | 2 | 1 | | ||
| | (no label) | 1 | 1 | | ||
| ``` | ||
|
|
||
| ## Related Features | ||
| - [Skip Labels](./skip_labels.md) – defines which labels mark records as skipped. | ||
| - [Service Chapters](./service_chapters.md) – quality diagnostics (skipped records are excluded there). | ||
|
|
||
| ← [Back to Feature Tutorials](../../README.md#feature-tutorials) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Invalid
show-stats-chaptersvalues are silently accepted asFalse.get_show_stats_chapters()coerces any non-"true"value toFalse, so the validation at Line 599-600 can never fail for malformed inputs (e.g.,"treu"), causing silent behavior changes.💡 Proposed fix (strict bool parsing with validation)
@@ `@staticmethod` def get_show_stats_chapters() -> bool: """ Get the show stats chapters parameter value from the action inputs. """ - return get_action_input(SHOW_STATS_CHAPTERS, "true").lower() == "true" + raw = (get_action_input(SHOW_STATS_CHAPTERS, "true") or "").strip().lower() + return raw == "true" @@ - show_stats_chapters = ActionInputs.get_show_stats_chapters() - ActionInputs.validate_input(show_stats_chapters, bool, "Show stats chapters must be a boolean.", errors) + show_stats_chapters_raw = (get_action_input(SHOW_STATS_CHAPTERS, "true") or "").strip().lower() + if show_stats_chapters_raw not in ("true", "false"): + errors.append("Show stats chapters must be 'true' or 'false'.") + show_stats_chapters = show_stats_chapters_raw == "true"As per coding guidelines,
**/*.py: Centralize parsing and validation in one input layer.Also applies to: 599-600
🤖 Prompt for AI Agents