From 8914ba2c64d1abbca040338c275cd883fdcf41c8 Mon Sep 17 00:00:00 2001 From: Ephraim Anierobi Date: Wed, 20 Mar 2024 13:04:15 +0100 Subject: [PATCH] Fix changelog generation for minor releases (#38321) Update how we search for existing PRs --- dev/airflow-github | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/dev/airflow-github b/dev/airflow-github index 5b07efa1b4a..2d1567948d3 100755 --- a/dev/airflow-github +++ b/dev/airflow-github @@ -323,12 +323,8 @@ def changelog(previous_version, target_version, github_token, disable_progress_b gh = Github(github_token) gh_repo = gh.get_repo("apache/airflow") sections = defaultdict(list) - existing_commits = set() - with open("../RELEASE_NOTES.rst") as file: - for line in file.readlines(): - match = re.search(r"\(#(\w+)\)", line) - if match: - existing_commits.add(match.group(1)) + with open("RELEASE_NOTES.rst") as file: + existing_pr_nos = re.findall(r"\(#(\d+)\)", file.read()) console = Console(width=180) @@ -340,7 +336,8 @@ def changelog(previous_version, target_version, github_token, disable_progress_b issue = gh_repo.get_issue(number=int(tickets[0][1:])) issue_type = get_issue_type(issue) files = files_touched(repo, commit["id"]) - if commit["id"] in existing_commits: + if str(issue.number) in existing_pr_nos: + print(f"Skipping {issue.number} as it's already in RELEASE_NOTES.rst") continue if is_core_commit(files): sections[issue_type].append(commit["subject"])