wjones127 commented on a change in pull request #11571:
URL: https://github.com/apache/arrow/pull/11571#discussion_r748598536
##########
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:
It would be extra nice to have a link to the GA run that was attempting
to submit. I think this should get you that:
```python
url = "{server}/{repo}/actions/runs/{run_id}".format(
server=os.environ["GITHUB_SERVER_URL"],
repo=os.environ["GITHUB_REPOSITORY"],
run_id=os.environ["GITHUB_RUN_ID"],
)
```
##########
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'}
Review comment:
I think the comment on lines 96-97 should stay with this line, as the
linked docs explain the meaning of these roles.
--
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]