Skip to content
Snippets Groups Projects
Unverified Commit 3b23338f authored by Newbyte's avatar Newbyte :snowflake:
Browse files

mrhlpr.mr: Improve error message when authentication fails (MR 47)

parent 135912ab
No related branches found
No related tags found
1 merge request!47mrhlpr.mr: Improve error message when authentication fails
Pipeline #185183 passed
......@@ -469,7 +469,15 @@ def finish(
git.push_head(remote_local, status.source_branch)
gl = gitlab_api.Gitlab(url="https://gitlab.com", private_token=gitlab_token)
gl.auth()
try:
gl.auth()
except gitlab_api.exceptions.GitlabAuthenticationError as authentication_exception:
logging.error(
"Authenticating with the token from GITLAB_TOKEN in the environment produced the following error: %s\n\nSee https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html",
authentication_exception,
)
exit(1)
project = gl.projects.get(origin.project_id)
mr = project.mergerequests.get(mr_id)
if skip_approve or (gl.user and mr.author and gl.user.id == mr.author.get("id")):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment