From d8269689d1e9f540d467e0211fe76864da81d2a4 Mon Sep 17 00:00:00 2001 From: Kavya Rambhia Date: Sun, 30 Mar 2025 22:19:31 +0530 Subject: [PATCH 1/3] restricted labels --- .github/utilities/issue_assign.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/utilities/issue_assign.py b/.github/utilities/issue_assign.py index 0acc002560..6cb0d268bd 100755 --- a/.github/utilities/issue_assign.py +++ b/.github/utilities/issue_assign.py @@ -19,13 +19,23 @@ issue_number = context_dict["event"]["issue"]["number"] issue = repo.get_issue(number=issue_number) comment_body = context_dict["event"]["comment"]["body"] +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: - 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) From 2713fb05b306439ad08fa1993b916df18f8c734e Mon Sep 17 00:00:00 2001 From: Kavya Rambhia Date: Sat, 5 Apr 2025 23:17:01 +0530 Subject: [PATCH 2/3] set --- .github/utilities/issue_assign.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/utilities/issue_assign.py b/.github/utilities/issue_assign.py index 6cb0d268bd..99deb9cd24 100755 --- a/.github/utilities/issue_assign.py +++ b/.github/utilities/issue_assign.py @@ -27,7 +27,7 @@ body = comment_body.lower() if "@aeon-actions-bot" in body and "assign" in body: if issue_labels & restricted_labels: - restricted = {restricted_labels & issue_labels} + restricted = restricted_labels & issue_labels issue.create_comment( f"This issue contains the following restricted label(s): " f"{', '.join(restricted)}. Assignment is skipped." From ec650a8a55e95f2d42004a2d34ac3d9148da70cd Mon Sep 17 00:00:00 2001 From: Kavya Rambhia Date: Sat, 5 Apr 2025 23:53:32 +0530 Subject: [PATCH 3/3] resolve conflicts --- .github/utilities/issue_assign.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/utilities/issue_assign.py b/.github/utilities/issue_assign.py index 99deb9cd24..3470cca1ad 100755 --- a/.github/utilities/issue_assign.py +++ b/.github/utilities/issue_assign.py @@ -2,7 +2,7 @@ It checks if a comment on an issue or PR includes the trigger phrase (as defined) and a mentioned user. -If it does, it assigns the issue/PR to the mentioned user. +If it does, it assigns the issue to the mentioned user. """ import json @@ -19,13 +19,14 @@ issue_number = context_dict["event"]["issue"]["number"] 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: +if "@aeon-actions-bot" in body and "assign" in body and not pr: if issue_labels & restricted_labels: restricted = restricted_labels & issue_labels issue.create_comment(