#!/usr/bin/env python3
import requests
from constants import PROJECT, TOKEN
def post_mr(
source_branch,
target_branch,
title,
description,
labels,
remove_source_branch,
assignee_ids,
):
params = {
"source_branch": source_branch,
"target_branch": target_branch,
"title": title,
"description": description,
"labels": labels,
"remove_source_branch": remove_source_branch,
"assignee_ids": assignee_ids,
}
headers = {"Private-Token": TOKEN}
with requests.post(
f"https://gitlab.fi.muni.cz/api/v4/projects/{PROJECT}/merge_requests",
params=params,
headers=headers,
) as req:
print(req.status_code)
def get_mrs_for_branch(branch):
params = {"source_branch": branch}
with requests.get(
return req.json()
def merge_mr(iid):
with requests.put(
f"https://gitlab.fi.muni.cz/api/v4/projects/{PROJECT}/merge_requests/{iid}/merge",
def set_assignees(iid, assignee_ids):
params = {"assignee_ids": assignee_ids}
f"https://gitlab.fi.muni.cz/api/v4/projects/{PROJECT}/merge_requests/{iid}",
def get_comments(iid):
params = {"sort": "asc"}
f"https://gitlab.fi.muni.cz/api/v4/projects/{PROJECT}/merge_requests/{iid}/notes",