From 4394c4e18ec05a35d3f6594ecda5617d466075c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Fri, 25 Oct 2024 12:23:25 +0200 Subject: [PATCH] Don't steal pull request If a pull request has already a milestone (=> consider as be in an other release) don't put it in the new release. --- .../module/standard/changelog.py | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/github_app_geo_project/module/standard/changelog.py b/github_app_geo_project/module/standard/changelog.py index fc64fc9529..393ec11f77 100644 --- a/github_app_geo_project/module/standard/changelog.py +++ b/github_app_geo_project/module/standard/changelog.py @@ -386,23 +386,24 @@ def generate_changelog( has_pr = False for pull_request in commit.get_pulls(): has_pr = True - authors = {Author(pull_request.user.login, pull_request.user.html_url)} - for commit_ in pull_request.get_commits(): - if commit_.author is not None: - authors.add(Author(commit_.author.login, commit_.author.html_url)) - pull_request.as_issue().edit(milestone=milestone) - changelog_items.add( - ChangelogItem( - github=pull_request, - ref=f"#{pull_request.number}", - title=pull_request.title, - author=Author(pull_request.user.login, pull_request.user.html_url), - authors=authors, - branch=pull_request.head.ref, - files={github_file.filename for github_file in pull_request.get_files()}, - labels={label.name for label in pull_request.get_labels()}, + if pull_request.milestone is None: + authors = {Author(pull_request.user.login, pull_request.user.html_url)} + for commit_ in pull_request.get_commits(): + if commit_.author is not None: + authors.add(Author(commit_.author.login, commit_.author.html_url)) + pull_request.as_issue().edit(milestone=milestone) + changelog_items.add( + ChangelogItem( + github=pull_request, + ref=f"#{pull_request.number}", + title=pull_request.title, + author=Author(pull_request.user.login, pull_request.user.html_url), + authors=authors, + branch=pull_request.head.ref, + files={github_file.filename for github_file in pull_request.get_files()}, + labels={label.name for label in pull_request.get_labels()}, + ) ) - ) if not has_pr: author = Author(commit.author.login, commit.author.html_url) if commit.author else None changelog_items.add(