fix(commit.py): filter merge request search to 'opened' and on current branch.
Merge request search now filters to 'opened' and to ones on the current branch. if none were found, outputs 'ci: No Merge Request found, MR count "0"' any other error with finding the merge request will output 'failed to fetch Merge Request title' this enables further debugging for potential errors. fixes #6 !13
This commit is contained in:
@ -41,7 +41,7 @@ for opt, arg in opts:
|
|||||||
#gl = gitlab.Gitlab('https://gitlab.com', private_token=ci_job_token)
|
#gl = gitlab.Gitlab('https://gitlab.com', private_token=ci_job_token)
|
||||||
|
|
||||||
|
|
||||||
url = 'https://gitlab.com/api/v4/projects/' + project_id + '/merge_requests'
|
url = 'https://gitlab.com/api/v4/projects/' + project_id + '/merge_requests?state=opened&source_branch=' + git_branch
|
||||||
|
|
||||||
merge_requests = ""
|
merge_requests = ""
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ if not isinstance(merge_requests, list):
|
|||||||
#mrs = gl.mergerequests.list()
|
#mrs = gl.mergerequests.list()
|
||||||
|
|
||||||
|
|
||||||
mr_title = ''
|
mr_title = 'failed to fetch Merge Request title'
|
||||||
mr_first_commit = ''
|
mr_first_commit = ''
|
||||||
target_branch = ''
|
target_branch = ''
|
||||||
|
|
||||||
@ -96,5 +96,5 @@ if isinstance(merge_requests, list):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
print('ci: No Merge Request found')
|
print('ci: No Merge Request found, MR count "0"')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user