Skip to content

Commit

Permalink
Remove changelog maintainer mention filter (#5527)
Browse files Browse the repository at this point in the history
But no need to mention when maintainers are issue reporters,
so keep that as is.

Signed-off-by: Anders Eknert <[email protected]>
  • Loading branch information
anderseknert authored Jan 4, 2023
1 parent 38d446b commit d03a9ad
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions build/changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,6 @@ def fetch(url, token):
else:
return result


def get_maintainers():
with open("MAINTAINERS.md", "r") as f:
contents = f.read()
maintainers = re.findall(r"[^\s]+@[^\s]+", contents)
return maintainers

maintainers = get_maintainers()


def is_maintainer(commit_message):
author = author_email(commit_message)
return author in maintainers

org_members_usernames = []
def get_org_members(token):
url = "https://api.github.com/orgs/open-policy-agent/members?per_page=100"
Expand All @@ -72,7 +58,6 @@ def get_org_members(token):
if login:
org_members_usernames.append(str(login))
if email:
maintainers.append(str(email))
github_ids[email]=login

def author_email(commit_message):
Expand Down Expand Up @@ -101,9 +86,7 @@ def get_github_id(commit_message, commit_id, token):

def mention_author(commit_message, commit_id, token):
username = get_github_id(commit_message, commit_id, token)
if username not in org_members_usernames:
return "authored by @{author}".format(author=username)
return ""
return "authored by @{author}".format(author=username)

def get_issue_reporter(issue_id, token):
url = "https://api.github.com/repos/open-policy-agent/opa/issues/{issue_id}".format(issue_id=issue_id)
Expand Down Expand Up @@ -163,8 +146,7 @@ def main():
mention = ""
reporter = ""
commit_message = get_commit_message(commit_id)
if not is_maintainer(commit_message):
mention = mention_author(commit_message, commit_id, args.token)
mention = mention_author(commit_message, commit_id, args.token)
issue_id = fixes_issue_id(commit_message)
if issue_id:
reporter = get_issue_reporter(issue_id, args.token)
Expand Down

0 comments on commit d03a9ad

Please sign in to comment.