Skip to content

Commit

Permalink
either get conclusion or status
Browse files Browse the repository at this point in the history
  • Loading branch information
KTachibanaM committed Nov 7, 2024
1 parent 9ee3c93 commit 8db190d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
5 changes: 3 additions & 2 deletions github_org_actions/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
... on Commit {
checkSuites(first: 100, filterBy: {appId: 15368}) {
nodes {
status
conclusion
workflowRun {
createdAt
Expand Down Expand Up @@ -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:
Expand Down
9 changes: 8 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": "🚫",
Expand Down

0 comments on commit 8db190d

Please sign in to comment.