Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Merge Request comment/activity/discussion#2631

Unanswered
dmoshayof asked this question inQ&A
Discussion options

Hi,
I want to comment a MR from python script
but I didn't find any mentions for that, do you have an idea?

You must be logged in to vote

Replies: 2 comments 4 replies

Comment options

You can comment on MR with following code:

gl=# init and auth main Gitlab objectproject=gl.projects.get(project_id)mr=project.mergerequests.get(mr_iid)mr.discussions.create({"body":"New comment"})

whereproject_id needs to be inputtedmr_idd

see more athttps://python-gitlab.readthedocs.io/en/stable/gl_objects/discussions.html#examples

You must be logged in to vote
0 replies
Comment options

I'd like to use API to set MR to auto-approve, something likegitlab --private-token $GITLAB_TOKEN project-merge-request update --project-id XXX --uuid YYY --state-event ZZZ. Is this possible? What would ZZZ be?

You must be logged in to vote
4 replies
@nejch
Comment options

@magicalbob what exactly do you mean by "set MR to auto-approve"? Do you just mean you want to approve the MR via the API?

@magicalbob
Comment options

@nejch I mean I want to update the MR so that its as if a user has pressed theSet to auto-merge button, if you see what I mean? So that when a user does approve the MR it will auto merge.

@magicalbob
Comment options

Sogitlab --private-token $GITLAB_TOKEN project-merge-request merge --project-id 24448408 --iid 169 --merge-when-pipeline-succeeds True did nearly what I wanted to do - it merged the MR, once I'd made sure all approvals were in (so MR was was ready to merge) ......

@nejch
Comment options

@magicalbob sorry for the late response, but that should be it yes. It's just that the API seems to only use the old terminology (it used to be MWPS only, but now it's expaded to auto-merge as it applies to other checks not just pipeline success).

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
4 participants
@dmoshayof@magicalbob@nejch@unbearables

[8]ページ先頭

©2009-2025 Movatter.jp