mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add support for Workflows (#1496)
To start supporting GitHub Actions, add the first part of that, Workflow, which encapsulates a workflow over the API, along with two methods on Repository to query them.
This commit is contained in:
@@ -135,6 +135,7 @@ import github.StatsPunchCard
|
||||
import github.Tag
|
||||
import github.Team
|
||||
import github.View
|
||||
import github.Workflow
|
||||
|
||||
from . import Consts
|
||||
|
||||
@@ -3000,6 +3001,29 @@ class Repository(github.GithubObject.CompletableGithubObject):
|
||||
github.NamedUser.NamedUser, self._requester, self.url + "/watchers", None
|
||||
)
|
||||
|
||||
def get_workflows(self):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/actions/workflows <https://developer.github.com/v3/actions/workflows>`_
|
||||
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Workflow.Workflow`
|
||||
"""
|
||||
return github.PaginatedList.PaginatedList(
|
||||
github.Workflow.Workflow,
|
||||
self._requester,
|
||||
self.url + "/actions/workflows",
|
||||
None,
|
||||
)
|
||||
|
||||
def get_workflow(self, id_or_name):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/actions/workflows/:workflow_id <https://developer.github.com/v3/actions/workflows>`_
|
||||
:rtype: :class:`github.Workflow.Workflow`
|
||||
"""
|
||||
assert isinstance(id_or_name, int) or isinstance(id_or_name, str), id_or_name
|
||||
headers, data = self._requester.requestJsonAndCheck(
|
||||
"GET", self.url + "/actions/workflows/" + id_or_name
|
||||
)
|
||||
return github.Workflow.Workflow(self._requester, headers, data, completed=True)
|
||||
|
||||
def has_in_assignees(self, assignee):
|
||||
"""
|
||||
:calls: `GET /repos/:owner/:repo/assignees/:assignee <http://developer.github.com/v3/issues/assignees>`_
|
||||
|
||||
Reference in New Issue
Block a user