jeszyb commented on a change in pull request #11571:
URL: https://github.com/apache/arrow/pull/11571#discussion_r749622382



##########
File path: dev/archery/archery/bot.py
##########
@@ -146,13 +141,20 @@ def handle_issue_comment(self, command, payload):
 
         comment = pull.get_issue_comment(payload['comment']['id'])
         try:
+            # Check privileges here to enable the bot to respond
+            # without relying on the handler.
+            allowed_roles = {'OWNER', 'MEMBER', 'CONTRIBUTOR'}
+            if payload['comment']['author_association'] not in allowed_roles:
+                raise EventError(
+                    "Only contributors can submit requests to this bot. "
+                    "Please ask someone from the community for help with "
+                    "getting the first commit in."
+                )
             self.handler(command, issue=issue, pull_request=pull,
                          comment=comment)
-        except CommandError as e:
-            logger.error(e)
-            pull.create_issue_comment("```\n{}\n```".format(e.message))
         except Exception as e:
             logger.exception(e)
+            pull.create_issue_comment(f"```\n{e}\n```")

Review comment:
       Added.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to