Skip to content

Commit 1e4b572

Browse files
committed
Update generate_release_notes.py
1 parent 625c737 commit 1e4b572

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

.github/scripts/generate_release_notes.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,35 @@ def fetch_commits():
4545
page += 1
4646
return commits
4747

48+
def is_bot_commit(commit):
49+
# Check if commit author or committer is a known bot
50+
author = commit.get('author')
51+
commit_author_name = commit['commit']['author']['name'].lower() if commit['commit']['author']['name'] else ''
52+
# author may be None or dict with 'login' key
53+
author_login = author.get('login', '').lower() if author else ''
54+
55+
bot_indicators = ['bot', 'dependabot', 'actions-user']
56+
57+
# Check login and commit author name for bot keywords
58+
if any(bot_name in author_login for bot_name in bot_indicators):
59+
return True
60+
if any(bot_name in commit_author_name for bot_name in bot_indicators):
61+
return True
62+
63+
return False
64+
4865
def filter_commits_by_date(commits):
4966
if not START_DATE and not END_DATE:
50-
return commits
67+
filtered = []
68+
for c in commits:
69+
if not is_bot_commit(c):
70+
filtered.append(c)
71+
return filtered
72+
5173
filtered = []
5274
for commit in commits:
75+
if is_bot_commit(commit):
76+
continue
5377
commit_date = datetime.fromisoformat(commit['commit']['author']['date'].replace("Z", "+00:00"))
5478
if START_DATE and commit_date < START_DATE:
5579
continue

0 commit comments

Comments
 (0)