0

I am intending to make a bot that will make some automated merge request comments based off of the files associated with the merge request.

Is there any easy way to do this?

I stumbled upon a library called python-gitlab that seems helpful but am unsure of how to accomplish this.

It seems like I would have to get a merge request by the merge request id

mr = project.mergerequests.get(mr_id)

and then use the merge request to get the source branch how? then access the items via the source branch

items = project.repository_tree(path='docs', ref='branch1') # like this?

Is there a better way to accomplish creating merge request comments based off of the files associated with the merge request?

1 Answers1

2

You can list the changes in this MR:

changes = mr.changes()

The 'changes' are the summary of what files are changed and what changes they have. Try print them out. You will be happy about it.

Reference: https://python-gitlab.readthedocs.io/en/stable/gl_objects/mrs.html

Brad Pitt
  • 398
  • 3
  • 11