Skip to content

Commit

Permalink
Add delete method for Artifact (PyGithub#2313)
Browse files Browse the repository at this point in the history
Add a method to delete a stored artifact from Github Actions.
  • Loading branch information
Aleksei Fedotov committed Sep 28, 2022
1 parent c4f3c32 commit fc4e77f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions github/Artifact.py
Expand Up @@ -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} <https://docs.github.com/en/rest/actions/artifacts#delete-an-artifact>`_
: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
Expand Down
1 change: 1 addition & 0 deletions github/Artifact.pyi
Expand Up @@ -6,6 +6,7 @@ class Artifact(github.GithubObject.NonCompletableGithubObject):
def archive_download_url(self) -> str: ...
@property
def created_at(self) -> datetime: ...
def delete(self) -> bool: ...
@property
def expired(self) -> bool: ...
@property
Expand Down

0 comments on commit fc4e77f

Please sign in to comment.