Skip to content

Commit

Permalink
Add created and check_suite_id filter for Repository WorkflowRuns (
Browse files Browse the repository at this point in the history
…#2891)

Co-authored-by: Josh Taylor <joshuataylorx@gmail.com>
Co-authored-by: Enrico Minack <github@enrico.minack.dev>
  • Loading branch information
3 people committed Mar 14, 2024
1 parent 0b8435f commit c788985
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 0 deletions.
10 changes: 10 additions & 0 deletions github/Repository.py
Expand Up @@ -3344,6 +3344,8 @@ def get_workflow_runs(
status: Opt[str] = NotSet,
exclude_pull_requests: Opt[bool] = NotSet,
head_sha: Opt[str] = NotSet,
created: Opt[str] = NotSet,
check_suite_id: Opt[int] = NotSet,
) -> PaginatedList[WorkflowRun]:
"""
:calls: `GET /repos/{owner}/{repo}/actions/runs <https://docs.github.com/en/rest/reference/actions#list-workflow-runs-for-a-repository>`_
Expand All @@ -3353,6 +3355,8 @@ def get_workflow_runs(
:param status: string `queued`, `in_progress`, `completed`, `success`, `failure`, `neutral`, `cancelled`, `skipped`, `timed_out`, or `action_required`
:param exclude_pull_requests: bool
:param head_sha: string
:param created: string Created filter, see https://docs.github.com/en/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax#query-for-dates
:param check_suite_id: int
:rtype: :class:`PaginatedList` of :class:`github.WorkflowRun.WorkflowRun`
"""
Expand All @@ -3362,6 +3366,8 @@ def get_workflow_runs(
assert is_optional(status, str), status
assert is_optional(exclude_pull_requests, bool), exclude_pull_requests
assert is_optional(head_sha, str), head_sha
assert is_optional(created, str), created
assert is_optional(check_suite_id, int), check_suite_id

url_parameters: dict[str, Any] = {}
if is_defined(actor):
Expand All @@ -3382,6 +3388,10 @@ def get_workflow_runs(
url_parameters["exclude_pull_requests"] = 1
if is_defined(head_sha):
url_parameters["head_sha"] = head_sha
if is_defined(created):
url_parameters["created"] = created
if is_defined(check_suite_id):
url_parameters["check_suite_id"] = check_suite_id

return PaginatedList(
github.WorkflowRun.WorkflowRun,
Expand Down

0 comments on commit c788985

Please sign in to comment.