@@ -11,18 +11,18 @@ import {
1111
1212import {
1313 type GitifyCheckSuiteStatus ,
14- type GitifyNotification ,
1514 type GitifySubject ,
1615 IconColor ,
1716 type Link ,
1817 type SettingsState ,
1918} from '../../../types' ;
19+ import type { Notification , Subject } from '../../../typesGitHub' ;
2020import { actionsURL } from '../../helpers' ;
2121import { DefaultHandler , defaultHandler } from './default' ;
2222
2323export interface CheckSuiteAttributes {
2424 workflowName : string ;
25- attemptNumber ? : number ;
25+ attemptNumber : number | null ;
2626 statusDisplayName : string ;
2727 status : GitifyCheckSuiteStatus | null ;
2828 branchName : string ;
@@ -32,9 +32,9 @@ class CheckSuiteHandler extends DefaultHandler {
3232 readonly type = 'CheckSuite' ;
3333
3434 async enrich (
35- notification : GitifyNotification ,
35+ notification : Notification ,
3636 _settings : SettingsState ,
37- ) : Promise < Partial < GitifySubject > > {
37+ ) : Promise < GitifySubject | null > {
3838 const state = getCheckSuiteAttributes ( notification ) ?. status ;
3939
4040 if ( state ) {
@@ -45,10 +45,10 @@ class CheckSuiteHandler extends DefaultHandler {
4545 } ;
4646 }
4747
48- return { } ;
48+ return null ;
4949 }
5050
51- iconType ( subject : GitifySubject ) : FC < OcticonProps > | null {
51+ iconType ( subject : Subject ) : FC < OcticonProps > | null {
5252 switch ( subject . state as GitifyCheckSuiteStatus ) {
5353 case 'CANCELLED' :
5454 return StopIcon ;
@@ -63,7 +63,7 @@ class CheckSuiteHandler extends DefaultHandler {
6363 }
6464 }
6565
66- iconColor ( subject : GitifySubject ) : IconColor {
66+ iconColor ( subject : Subject ) : IconColor {
6767 switch ( subject . state as GitifyCheckSuiteStatus ) {
6868 case 'SUCCESS' :
6969 return IconColor . GREEN ;
@@ -74,7 +74,7 @@ class CheckSuiteHandler extends DefaultHandler {
7474 }
7575 }
7676
77- defaultUrl ( notification : GitifyNotification ) : Link {
77+ defaultUrl ( notification : Notification ) : Link {
7878 return getCheckSuiteUrl ( notification ) ;
7979 }
8080}
@@ -86,7 +86,7 @@ export const checkSuiteHandler = new CheckSuiteHandler();
8686 * but there isn't an obvious/clean way to do this currently.
8787 */
8888export function getCheckSuiteAttributes (
89- notification : GitifyNotification ,
89+ notification : Notification ,
9090) : CheckSuiteAttributes | null {
9191 const regex =
9292 / ^ (?< workflowName > .* ?) w o r k f l o w r u n ( , A t t e m p t # (?< attemptNumber > \d + ) ) ? (?< statusDisplayName > .* ?) f o r (?< branchName > .* ?) b r a n c h $ / ;
@@ -102,9 +102,7 @@ export function getCheckSuiteAttributes(
102102
103103 return {
104104 workflowName,
105- attemptNumber : attemptNumber
106- ? Number . parseInt ( attemptNumber , 10 )
107- : undefined ,
105+ attemptNumber : attemptNumber ? Number . parseInt ( attemptNumber , 10 ) : null ,
108106 status : getCheckSuiteStatus ( statusDisplayName ) ,
109107 statusDisplayName,
110108 branchName,
@@ -129,7 +127,7 @@ function getCheckSuiteStatus(
129127 }
130128}
131129
132- export function getCheckSuiteUrl ( notification : GitifyNotification ) : Link {
130+ export function getCheckSuiteUrl ( notification : Notification ) : Link {
133131 const filters = [ ] ;
134132
135133 const checkSuiteAttributes = getCheckSuiteAttributes ( notification ) ;
@@ -148,5 +146,5 @@ export function getCheckSuiteUrl(notification: GitifyNotification): Link {
148146 filters . push ( `branch:${ checkSuiteAttributes . branchName } ` ) ;
149147 }
150148
151- return actionsURL ( notification . repository . htmlUrl , filters ) ;
149+ return actionsURL ( notification . repository . html_url , filters ) ;
152150}
0 commit comments