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:
Steve Kowalik
2021-10-15 15:40:09 +11:00
committed by GitHub
parent 53fb49882f
commit b1c8eec58f
3 changed files with 34 additions and 0 deletions
+8
View File
@@ -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