Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions baldrick/github/github_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,24 @@ def set_labels(self, labels):
json=missing_labels)
assert response.ok, response.content

def set_assignees(self, assignees):
"""Assign the issue to the specified assignee(s)."""

response = requests.post(f'{self._url_issue}/assignees',
headers=self._headers,
json={'assignees': list(assignees)})

assert response.ok, response.content

def add_assignees(self, assignees):
"""Add the specified assignee(s) to the issue."""

if isinstance(assignees, str): # single assignee passed in
assignees = [assignees]

current_assignees = self.json.get('assignees', [])
return self.set_assignees(current_assignees + list(assignees))

def close(self):
url = f'{HOST}/repos/{self.repo}/issues/{self.number}'
parameters = {'state': 'closed'}
Expand Down