Skip to content
Snippets Groups Projects
Commit f96e3992 authored by Amir Mohammadi's avatar Amir Mohammadi
Browse files

Add create_merge_request ability to our gitlab wrapper class

parent b2fc33b0
No related branches found
No related tags found
1 merge request!34Adapt our scripts to use our channel
......@@ -91,6 +91,22 @@ class Gitlab(object):
pipeline = subprocess.check_output(cmd)
return json.loads(pipeline.decode())
def create_merge_request(self, project_id, source_branch, target_branch, title,
assignee_id='', description='', target_project_id='',
labels='', milestone_id='', remove_source_branch=''):
url = "projects/{}/merge_requests?"
url += "&".join(['source_branch={}', 'target_branch={}', 'title={}'])
url += "&".join(['assignee_id={}', 'description={}', 'target_project_id={}',
'labels={}', 'milestone_id={}', 'remove_source_branch={}'])
url = url.format(project_id, source_branch, target_branch, title,
assignee_id, description, target_project_id, labels,
milestone_id, remove_source_branch)
cmd = ["curl", "--request", "POST", "--header",
"PRIVATE-TOKEN: {}".format(self.token),
self.base_url + url]
pipeline = subprocess.check_output(cmd)
return json.loads(pipeline.decode())
def main(packages_list):
gitlab = Gitlab(os.environ.get('GITLAB_API_TOKEN'))
......
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