@@ -355,9 +355,9 @@ def get_commit_status(self, ref):
355355 owner = self .owner ,
356356 repo = self .slug , ref = ref )
357357
358- actions = AggregatedCheckSuites .get (self .client ,
359- owner = self .owner ,
360- repo = self .slug , ref = ref )
358+ actions = AggregatedCheckRuns .get (self .client ,
359+ owner = self .owner ,
360+ repo = self .slug , ref = ref )
361361 combined .status [actions .key ] = actions
362362
363363 except HTTPError as err :
@@ -507,62 +507,41 @@ def __str__(self) -> str:
507507 return self .state
508508
509509
510- class AggregatedCheckRuns (base .AbstractGitHostObject ):
510+ class AggregatedCheckRuns (base .AbstractGitHostObject ,
511+ base .AbstractBuildStatus ):
512+
511513 """
512514 The Endpoint to have access infos about github actions runs
513515 """
514516 GET_URL = '/repos/{owner}/{repo}/commits/{ref}/check-runs'
515517 SCHEMA = schema .AggregateCheckRuns
516518
517- @property
518- def html_url (self ):
519- if self .data ['total_count' ]:
520- return self .data ['check_runs' ][0 ]['html_url' ]
521- return ''
522-
523-
524- class AggregatedCheckSuites (base .AbstractGitHostObject ,
525- base .AbstractBuildStatus ):
526- """
527- The Endpoint to have access infos about github actions suites
528- """
529- GET_URL = '/repos/{owner}/{repo}/commits/{ref}/check-suites'
530- SCHEMA = schema .AggregateCheckSuites
531-
532519 def __init__ (self , * args , ** kwargs ):
533520 super ().__init__ (* args , ** kwargs )
534- self ._check_suites = [elem for elem in self .data ['check_suites' ]]
535-
536- @classmethod
537- def get (cls , client , url = None , params = {}, headers = {}, ** kwargs ):
538- res = super (AggregatedCheckSuites , cls )\
539- .get (client , url , params , headers , ** kwargs )
540-
541- html_url = AggregatedCheckRuns \
542- .get (client , url , params , headers , ** kwargs ).html_url
543- res .data ['html_url' ] = html_url
544- return res
521+ self ._check_runs = [elem for elem in self .data ['check_runs' ]]
545522
546523 @property
547524 def url (self ):
548- return self .data ['html_url' ]
525+ if len (self .data ['check_runs' ]):
526+ return self .data ['check_runs' ][0 ]['html_url' ]
527+ return ''
549528
550529 @property
551530 def state (self ):
552531 queued = any (
553- elem ['status' ] == 'queued' for elem in self ._check_suites
532+ elem ['status' ] == 'queued' for elem in self ._check_runs
554533 )
555534 all_complete = all (
556- elem ['status' ] == 'completed' for elem in self ._check_suites
535+ elem ['status' ] == 'completed' for elem in self ._check_runs
557536 )
558537 all_success = all (
559- elem ['conclusion' ] == 'success' for elem in self ._check_suites
538+ elem ['conclusion' ] == 'success' for elem in self ._check_runs
560539 )
561- if self ._check_suites .__len__ () > 0 and queued :
540+ if self ._check_runs .__len__ () > 0 and queued :
562541 return 'NOTSTARTED'
563- elif self ._check_suites .__len__ () > 0 and not all_complete :
542+ elif self ._check_runs .__len__ () > 0 and not all_complete :
564543 return 'INPROGRESS'
565- elif self ._check_suites .__len__ () > 0 and all_complete and all_success :
544+ elif self ._check_runs .__len__ () > 0 and all_complete and all_success :
566545 return 'SUCCESSFUL'
567546 else :
568547 return 'FAILED'
@@ -577,8 +556,8 @@ def key(self) -> str:
577556
578557 @property
579558 def commit (self ):
580- if self ._check_suites .__len__ () > 0 :
581- return self ._check_suites [0 ]["head_sha" ]
559+ if self ._check_runs .__len__ () > 0 :
560+ return self ._check_runs [0 ]["head_sha" ]
582561 else :
583562 return None
584563
0 commit comments