Add name filter to Repository.get_artifacts() (#2459)

Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
Trim21
2023-06-01 14:32:55 +02:00
committed by GitHub
co-authored by Enrico Minack
parent 10816389d2
commit 9f52e9486a
10 changed files with 243 additions and 94 deletions
+11 -2
View File
@@ -3831,17 +3831,26 @@ class Repository(github.GithubObject.CompletableGithubObject):
)
return github.CheckRun.CheckRun(self._requester, headers, data, completed=True)
def get_artifacts(self):
def get_artifacts(self, name=github.GithubObject.NotSet):
"""
:calls: `GET /repos/{owner}/{repo}/actions/artifacts <https://docs.github.com/en/rest/actions/artifacts#list-artifacts-for-a-repository>`_
:param name: str
:rtype: :class:`github.PaginatedList.PaginatedList` of :class:`github.Artifact.Artifact`
"""
assert name is github.GithubObject.NotSet or isinstance(name, str), name
param = {
key: value
for key, value in {"name": name}.items()
if value is not github.GithubObject.NotSet
}
return github.PaginatedList.PaginatedList(
github.Artifact.Artifact,
self._requester,
f"{self.url}/actions/artifacts",
None,
firstParams=param,
list_item="artifacts",
)