| |
@@ -270,7 +270,8 @@
|
| |
initial_commit=issue_body.get(
|
| |
'initial_commit', True))
|
| |
elif issue_body.get('action') == 'new_branch':
|
| |
- prompt_for_new_branch(issue, issue_body, auto_approve=auto_approve)
|
| |
+ prompt_for_new_branch(issue, issue_body, force=force,
|
| |
+ auto_approve=auto_approve)
|
| |
else:
|
| |
prompt_to_close_bad_ticket(issue, "Invalid or missing action field")
|
| |
return
|
| |
@@ -480,7 +481,7 @@
|
| |
return
|
| |
|
| |
|
| |
- def prompt_for_new_branch(issue_json, issue_body_json, auto_approve=False):
|
| |
+ def prompt_for_new_branch(issue_json, issue_body_json, force=False, auto_approve=False):
|
| |
"""
|
| |
A helper function that prompts the user with information on a new branch
|
| |
ticket
|
| |
@@ -549,6 +550,19 @@
|
| |
issue_owner = issue_json['user']['name']
|
| |
issue_ui_url = fedscm_admin.pagure.get_pagure_issue_url(issue_id)
|
| |
|
| |
+ # Check if the branch requestor is one of the maintainers
|
| |
+ click.echo('- Checking if {0} is one of the maintainers of the package'.format(issue_owner))
|
| |
+ if force:
|
| |
+ msg = ' WARNING: Checking of maintainers is skipped'
|
| |
+ click.secho(msg, fg='yellow')
|
| |
+ else:
|
| |
+ maintainers = set(project['access_users']['owner']) | set(project['access_users']['admin'])
|
| |
+ if issue_owner not in maintainers:
|
| |
+ prompt_to_close_bad_ticket(
|
| |
+ issue_json, '{0} is not a maintainer of the {1} package'.format(issue_owner, repo)
|
| |
+ )
|
| |
+ return
|
| |
+
|
| |
if auto_approve and \
|
| |
not ticket_requires_approval('new_branch', issue_body_json):
|
| |
click.echo('- Auto-approving the new branch request for "{0}" on '
|
| |
Signed-off-by: Mohan Boddu mboddu@bhujji.com