From 55dca6ffa2ae6e7b4ca2b483f088e1af5ec29be1 Mon Sep 17 00:00:00 2001 From: Aleksei Fedotov Date: Wed, 28 Sep 2022 11:56:51 +0000 Subject: [PATCH] Add delete method for Artifact (#2313) Add a method to delete a stored artifact from Github Actions. --- github/Artifact.py | 8 ++++++++ github/Artifact.pyi | 1 + 2 files changed, 9 insertions(+) diff --git a/github/Artifact.py b/github/Artifact.py index 018e8e5cbd..741bfea04d 100644 --- a/github/Artifact.py +++ b/github/Artifact.py @@ -116,6 +116,14 @@ def workflow_run(self): """ return self._workflow_run.value + def delete(self) -> bool: + """ + :calls: `DELETE /repos/{owner}/{repo}/actions/artifacts/{artifact_id} `_ + :rtype: bool + """ + status, headers, data = self._requester.requestBlob("DELETE", self.url) + return status == 204 + def _initAttributes(self): self._archive_download_url = github.GithubObject.NotSet self._created_at = github.GithubObject.NotSet diff --git a/github/Artifact.pyi b/github/Artifact.pyi index 563d2bdb66..4fe7872ae7 100644 --- a/github/Artifact.pyi +++ b/github/Artifact.pyi @@ -7,6 +7,7 @@ class Artifact(NonCompletableGithubObject): def archive_download_url(self) -> str: ... @property def created_at(self) -> datetime: ... + def delete(self) -> bool: ... @property def expired(self) -> bool: ... @property