mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 10:51:14 +00:00
Add method to delete Workflow runs (#2078)
One piece of missing functionality is the ability to delete Workflow Runs, which the GitHub API supports. Add a delete() method to WorkflowRun. Fixes #2019
This commit is contained in:
@@ -243,6 +243,14 @@ class WorkflowRun(github.GithubObject.CompletableGithubObject):
|
||||
timingdata = namedtuple("TimingData", data.keys())
|
||||
return timingdata._make(data.values())
|
||||
|
||||
def delete(self):
|
||||
"""
|
||||
:calls: `DELETE /repos/{owner}/{repo}/actions/runs/{run_id} <https://docs.github.com/en/rest/reference/actions#workflow-runs>`_
|
||||
:rtype: bool
|
||||
"""
|
||||
status, _, _ = self._requester.requestJson("DELETE", self.url)
|
||||
return status == 204
|
||||
|
||||
def _initAttributes(self):
|
||||
self._id = github.GithubObject.NotSet
|
||||
self._head_branch = github.GithubObject.NotSet
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -105,3 +105,7 @@ class WorkflowRun(Framework.TestCase):
|
||||
|
||||
def test_cancel(self):
|
||||
self.assertTrue(self.workflow_run.cancel())
|
||||
|
||||
def test_delete(self):
|
||||
wr = self.repo.get_workflow_run(1327550476)
|
||||
self.assertTrue(wr.delete())
|
||||
|
||||
Reference in New Issue
Block a user