From 8db190d4b3fa188fecb8ba862d901a3d0f399b4a Mon Sep 17 00:00:00 2001 From: KTachibanaM Date: Thu, 7 Nov 2024 13:56:51 -0800 Subject: [PATCH] either get conclusion or status --- github_org_actions/github.py | 5 +++-- main.py | 9 ++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/github_org_actions/github.py b/github_org_actions/github.py index ceea98f..dfa6c2c 100644 --- a/github_org_actions/github.py +++ b/github_org_actions/github.py @@ -17,6 +17,7 @@ ... on Commit { checkSuites(first: 100, filterBy: {appId: 15368}) { nodes { + status conclusion workflowRun { createdAt @@ -56,13 +57,13 @@ async def get_res(org: str, excluded_repos: list[str], token: str) -> list[RepoR workflow_res_list = [] # type: list[WorkflowResult] for check_suite in repo["defaultBranchRef"]["target"]["checkSuites"]["nodes"]: - if check_suite["workflowRun"] is None: + if not check_suite["workflowRun"]: continue workflow_res_list.append(WorkflowResult( name=check_suite["workflowRun"]["workflow"]["name"], run_url=check_suite["workflowRun"]["url"], created_at=check_suite["workflowRun"]["createdAt"], - status=check_suite["conclusion"].lower() + status=(check_suite["conclusion"] or check_suite["status"]).lower() )) workflow_res_list.sort(key=lambda x: x.created_at, reverse=True) if not workflow_res_list: diff --git a/main.py b/main.py index e679f2d..92ad34b 100644 --- a/main.py +++ b/main.py @@ -48,8 +48,15 @@ def time_ago(timestamp): return f"{int(seconds)}s ago" -# GitHub GQL CheckConclusionState workflow_status_to_emoji_map = { + # GitHub GQL CheckStatusState + "requested": "🔄", + "queued": "🕒", + "in_progress": "🔄", + "completed": "🏁", + "waiting": "⏳", + "pending": "⏳", + # GitHub GQL CheckConclusionState "action_required": "✋", "timed_out": "⏰", "cancelled": "🚫",