-
Notifications
You must be signed in to change notification settings - Fork 0
#149 - Merge labels from PR and the connected issue #159
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,9 +58,9 @@ def generate(github: Github, data: MinedData) -> dict[int | str, Record]: | |||||||||||||
|
|
||||||||||||||
| def register_pull_request(pull: PullRequest, skip_rec: bool) -> None: | ||||||||||||||
| detected_issues = extract_issue_numbers_from_body(pull) | ||||||||||||||
| logger.debug(f"Detected issues - from body: {detected_issues}") | ||||||||||||||
| logger.debug("Detected issues - from body: %s", detected_issues) | ||||||||||||||
| detected_issues.update(safe_call(get_issues_for_pr)(pull_number=pull.number)) | ||||||||||||||
| logger.debug(f"Detected issues - final: {detected_issues}") | ||||||||||||||
| logger.debug("Detected issues - final: %s", detected_issues) | ||||||||||||||
|
|
||||||||||||||
| for parent_issue_number in detected_issues: | ||||||||||||||
| # create an issue record if not present for PR parent | ||||||||||||||
|
|
@@ -98,14 +98,14 @@ def register_pull_request(pull: PullRequest, skip_rec: bool) -> None: | |||||||||||||
|
|
||||||||||||||
| logger.debug("Registering pull requests to records...") | ||||||||||||||
| for pull in data.pull_requests: | ||||||||||||||
| pull_labels = [label.name for label in pull.labels] | ||||||||||||||
| pull_labels = [label.name for label in pull.get_labels()] | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Wrap API call to get_labels with rate-limiter. - pull_labels = [label.name for label in pull.get_labels()]
+ pull_labels = [label.name for label in safe_call(pull.get_labels)()]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| skip_record: bool = any(item in pull_labels for item in ActionInputs.get_skip_release_notes_labels()) | ||||||||||||||
|
|
||||||||||||||
| if not safe_call(get_issues_for_pr)(pull_number=pull.number) and not extract_issue_numbers_from_body(pull): | ||||||||||||||
| records[pull.number] = PullRequestRecord(pull, skip=skip_record) | ||||||||||||||
| logger.debug("Created record for PR %d: %s", pull.number, pull.title) | ||||||||||||||
| else: | ||||||||||||||
| logger.debug(f"Registering pull number: {pull.number}, title : {pull.title}") | ||||||||||||||
| logger.debug("Registering pull number: %s, title : %s", pull.number, pull.title) | ||||||||||||||
| register_pull_request(pull, skip_record) | ||||||||||||||
|
|
||||||||||||||
| logger.debug("Registering commits to records...") | ||||||||||||||
|
|
@@ -158,7 +158,7 @@ def _create_record_for_issue(records: dict[int | str, Record], i: Issue) -> None | |||||||||||||
| @return: None | ||||||||||||||
| """ | ||||||||||||||
| # check for skip labels presence and skip when detected | ||||||||||||||
| issue_labels = [label.name for label in i.labels] | ||||||||||||||
| issue_labels = [label.name for label in i.get_labels()] | ||||||||||||||
| skip_record = any(item in issue_labels for item in ActionInputs.get_skip_release_notes_labels()) | ||||||||||||||
| records[i.number] = IssueRecord(issue=i, skip=skip_record) | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+161
to
164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Same: wrap issue.get_labels with rate-limiter. - issue_labels = [label.name for label in i.get_labels()]
+ issue_labels = [label.name for label in safe_call(i.get_labels)()]📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
|
|
||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| pytest==7.4.3 | ||
| pytest-cov==5.0.0 | ||
| pytest-mock==3.14.0 | ||
| pytest==8.4.2 | ||
| pytest-cov==6.3.0 | ||
| pytest-mock==3.15.0 | ||
| PyGithub==1.59.0 | ||
| pylint==3.2.6 | ||
| requests==2.31.0 | ||
| black==24.8.0 | ||
| pylint==3.3.8 | ||
| requests==2.32.5 | ||
| black==25.1.0 | ||
| PyYAML==6.0.2 | ||
| semver==3.0.2 | ||
| mypy==1.15.0 | ||
| mypy-extensions==1.0.0 | ||
| types-requests==2.32.0.20250328 | ||
| types-PyYAML==6.0.2 | ||
| semver==3.0.4 | ||
| mypy==1.17.1 | ||
| mypy-extensions==1.1.0 | ||
| types-requests==2.32.4.20250809 | ||
| types-PyYAML==6.0.12.20250822 |
Uh oh!
There was an error while loading. Please reload this page.
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
Make label exposure deterministic to prevent flaky ordering
Returning a list from a set yields non-deterministic order; sorting avoids flaky tests and unstable output.
Apply:
Optionally, if you’d like a public helper to simplify tests and avoid touching
_labels, consider:🤖 Prompt for AI Agents
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.
This is not needed.
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.
@miroslavpojer, understood! I'll defer to your judgment on this. The current implementation works fine for your use case.