mirror of
https://github.com/status-im/PyGithub.git
synced 2026-08-31 19:01:15 +00:00
Add name filter to Repository.get_artifacts() (#2459)
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
This commit is contained in:
+11
-2
@@ -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",
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user