You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by am...@apache.org on 2024/01/05 06:30:03 UTC
(airflow) branch main updated: Optimise getting changelogs in airflow-github (#36548)
This is an automated email from the ASF dual-hosted git repository.
amoghdesai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 142c7376c6 Optimise getting changelogs in airflow-github (#36548)
142c7376c6 is described below
commit 142c7376c6d6566938ced345e97a1e2442e2fd32
Author: Amogh Desai <am...@gmail.com>
AuthorDate: Fri Jan 5 11:59:55 2024 +0530
Optimise getting changelogs in airflow-github (#36548)
---
dev/airflow-github | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/dev/airflow-github b/dev/airflow-github
index 46213b411a..7d4ad9ebb9 100755
--- a/dev/airflow-github
+++ b/dev/airflow-github
@@ -323,29 +323,30 @@ def changelog(previous_version, target_version, github_token):
# Get a list of issues/PRs that have been committed on the current branch.
log = get_commits_between(repo, previous_version, target_version)
+ print("Number of commits", len(log))
+
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))
+
for commit in log:
tickets = pr_title_re.findall(commit["subject"])
if tickets:
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:
+ continue
if is_core_commit(files):
- if issue_type in ["bug-fix", "doc-only", "misc/internal"]:
- with open("../RELEASE_NOTES.rst") as file:
- for line in file.readlines():
- if line.endswith(f"(#{commit['id']})"):
- continue
- else:
- sections[issue_type].append(commit["subject"])
- else:
- sections[issue_type].append(commit["subject"])
-
+ sections[issue_type].append(commit["subject"])
else:
sections[DEFAULT_SECTION_NAME].append(commit["subject"])
-
print_changelog(sections)