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:
2022-01-16 08:39:13 +09:30
parent 5c9000a748
commit 73918f2f5e

View File

@ -41,7 +41,7 @@ for opt, arg in opts:
#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 = ""
@ -77,7 +77,7 @@ if not isinstance(merge_requests, list):
#mrs = gl.mergerequests.list()
mr_title = ''
mr_title = 'failed to fetch Merge Request title'
mr_first_commit = ''
target_branch = ''
@ -96,5 +96,5 @@ if isinstance(merge_requests, list):
else:
print('ci: No Merge Request found')
print('ci: No Merge Request found, MR count "0"')