Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add created and check_suite_id filter for Repository Workflow runs #2891

Merged
merged 6 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions github/Repository.py
Original file line number Diff line number Diff line change
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