pull-requests: add merge check that detects WIP marker in title. This will prevent merges in such case.
Usually WIP in title means unfinished task that needs still some work. This pattern is present in Gitlab/Github and is already quite common.
This commit is contained in:
parent
aa65b092ff
commit
f069e0f0f9
3 changed files with 33 additions and 1 deletions
|
|
@ -1614,6 +1614,7 @@ class MergeCheck(object):
|
|||
PERM_CHECK = 'perm'
|
||||
REVIEW_CHECK = 'review'
|
||||
MERGE_CHECK = 'merge'
|
||||
WIP_CHECK = 'wip'
|
||||
|
||||
def __init__(self):
|
||||
self.review_status = None
|
||||
|
|
@ -1638,6 +1639,15 @@ class MergeCheck(object):
|
|||
_ = translator
|
||||
merge_check = cls()
|
||||
|
||||
# title has WIP:
|
||||
if pull_request.work_in_progress:
|
||||
log.debug("MergeCheck: cannot merge, title has wip: marker.")
|
||||
|
||||
msg = _('WIP marker in title prevents from accidental merge.')
|
||||
merge_check.push_error('error', msg, cls.WIP_CHECK, pull_request.title)
|
||||
if fail_early:
|
||||
return merge_check
|
||||
|
||||
# permissions to merge
|
||||
user_allowed_to_merge = PullRequestModel().check_user_merge(
|
||||
pull_request, auth_user)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue