empty MR_ACCESS_TOKEN uncaugt exception
📝 Description
during jobs MR title and commit messages if no variable MR_ACCESS_TOKEN is supplied the following error occurs and the job fails.
error message:
Traceback (most recent call last):
File "./gitlab-ci/conventional_commits/scripts/commit.py", line 80, in <module>
if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened':
TypeError: string indices must be integers
code in question Lines 76-83:
for mr in merge_requests:
# print('\n\nMR=[-{0}-]'.format(mr))
if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened':
mr_title = mr['title']
mr_first_commit = mr['sha']
target_branch = mr['target_branch']
🔗 Links / References
- commit.py Lines 76-83
- nofusscomputing/ops!2
🚧 Tasks
-
validate the cause of the bug -
if no MR_ACCESS_TOKENsupplied check if MR's are public, if so progress withoutMR_ACCESS_TOKENvariable -
if no MR_ACCESS_TOKENsupplied and MR's are not public, fail with error thatMR_ACCESS_TOKENvariable has to be supplied.-
output error if cant access MR if no MR_ACCESS_TOKENvariable supplied
-