Skip to content

[MNT] Prevents assignment on Restricted Labels #2706

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions .github/utilities/issue_assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,23 @@
issue = repo.get_issue(number=issue_number)
comment_body = context_dict["event"]["comment"]["body"]
pr = context_dict["event"]["issue"].get("pull_request")
issue_labels = {label.name.lower() for label in issue.labels}

restricted_labels = {"meta-issue"}

# Assign tagged used to the issue if the comment includes the trigger phrase
body = comment_body.lower()
if "@aeon-actions-bot" in body and "assign" in body and not pr:
mentioned_users = re.findall(r"@[a-zA-Z0-9_-]+", comment_body)
mentioned_users = [user[1:] for user in mentioned_users]
mentioned_users.remove("aeon-actions-bot")
if issue_labels & restricted_labels:
restricted = restricted_labels & issue_labels
issue.create_comment(
f"This issue contains the following restricted label(s): "
f"{', '.join(restricted)}. Assignment is skipped."
)
else:
mentioned_users = re.findall(r"@[a-zA-Z0-9_-]+", comment_body)
mentioned_users = [user[1:] for user in mentioned_users]
mentioned_users.remove("aeon-actions-bot")

for user in mentioned_users:
issue.add_to_assignees(user)
for user in mentioned_users:
issue.add_to_assignees(user)