Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mrhlpr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anjan Momi
mrhlpr
Commits
9ac0bdb7
Unverified
Commit
9ac0bdb7
authored
10 months ago
by
Pablo Correa Gomez
Browse files
Options
Downloads
Patches
Plain Diff
mrhlpr: do not approve if the logged-in user is the same as the author
As it will fail, and that's annoying! Fixes #18
parent
c889a3cf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mrhlpr/mr.py
+3
-3
3 additions, 3 deletions
mrhlpr/mr.py
with
3 additions
and
3 deletions
mrhlpr/mr.py
+
3
−
3
View file @
9ac0bdb7
...
...
@@ -468,10 +468,11 @@ def finish(
git
.
push_head
(
remote_local
,
status
.
source_branch
)
gl
=
gitlab_api
.
Gitlab
(
url
=
"
https://gitlab.com
"
,
private_token
=
gitlab_token
)
gl
.
auth
()
project
=
gl
.
projects
.
get
(
origin
.
project_id
)
mr
=
project
.
mergerequests
.
get
(
mr_id
)
if
skip_approve
:
print
(
"
Skipping approval
per request
...
"
)
if
skip_approve
or
(
gl
.
user
and
mr
.
author
and
gl
.
user
.
id
==
mr
.
author
.
get
(
"
id
"
))
:
print
(
"
Skipping approval...
"
)
else
:
print
(
"
Approving MR...
"
)
try
:
...
...
@@ -479,7 +480,6 @@ def finish(
# For some reason, approve fails with auth error if already approved...
except
gitlab_api
.
GitlabAuthenticationError
as
e
:
approved_by_ids
=
[
ap
[
"
id
"
]
for
ap
in
mr
.
approval_state
.
get
().
rules
[
0
][
"
approved_by
"
]]
gl
.
auth
()
if
gl
.
user
is
None
:
raise
e
if
gl
.
user
.
id
not
in
approved_by_ids
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment