Skip to content

Commit 6c70f06

Browse files
authored
Fix the commit email filters to exclude personal branches (#7)
Fixes: llvm/llvm-project#71185
1 parent a3b0398 commit 6c70f06

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

AWS/Lambda/CommitEmailer/commit_emailer.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,17 @@ def lambda_handler(event, context):
9898
'pstl': LIBCXX_COMMITS_ADDRESS,
9999
'zorg': LLVM_COMMITS_ADDRESS
100100
}
101+
102+
# Never send mail about personal branches
103+
if event['ref'].startswith('refs/heads/users/'):
104+
return {
105+
'statusCode' : 200,
106+
'body' : {
107+
"status" : True,
108+
"message" : "Ignoring commit to personal branch"
109+
}
110+
}
111+
101112
# Loop through the commits
102113
for commit in event['commits']:
103114
# initialize variables
@@ -175,8 +186,10 @@ def lambda_handler(event, context):
175186
# mail_to = os.environ['MAIL_TO']
176187
mail_to = project_path_email[project]
177188

178-
exclude_branches = ['main', 'master']
179-
if not any(x in event['ref'] for x in exclude_branches):
189+
# Everything on a non-personal, non-trunk branches should be
190+
# re-directed to the *branch* commits list
191+
trunk_branches = ['refs/heads/main', 'refs/heads/master']
192+
if not event['ref'] in trunk_branches:
180193
mail_to = LLVM_BRANCH_COMMITS_ADDRESS
181194

182195
# If we're sending an additional email to the same address, break instead

0 commit comments

Comments
 (0)