mirror of
https://github.com/status-im/PyGithub.git
synced 2026-09-02 11:51:10 +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",
|
||||
)
|
||||
|
||||
|
||||
@@ -315,7 +315,9 @@ class Repository(CompletableGithubObject):
|
||||
self, archive_format: str, ref: Union[str, _NotSetType] = ...
|
||||
) -> str: ...
|
||||
def get_artifact(self, artifact_id: int) -> Artifact: ...
|
||||
def get_artifacts(self) -> PaginatedList[Artifact]: ...
|
||||
def get_artifacts(
|
||||
self, name: Union[str, _NotSetType] = ...
|
||||
) -> PaginatedList[Artifact]: ...
|
||||
def get_assignees(self) -> PaginatedList[NamedUser]: ...
|
||||
def get_autolinks(self) -> PaginatedList[Autolink]: ...
|
||||
def get_branch(self, branch: str) -> Branch: ...
|
||||
|
||||
Reference in New Issue
Block a user