From 73918f2f5e19440d0e300da3a20712739c316d88 Mon Sep 17 00:00:00 2001 From: Jon Lockwood Date: Sun, 16 Jan 2022 08:39:13 +0930 Subject: [PATCH] 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 --- conventional_commits/scripts/commit.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conventional_commits/scripts/commit.py b/conventional_commits/scripts/commit.py index 0adb4b6..1bc1f57 100755 --- a/conventional_commits/scripts/commit.py +++ b/conventional_commits/scripts/commit.py @@ -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"')