@@ -27,18 +27,26 @@ export type PrEvent =
2727 | PRReviewerChangesRequested
2828 | PRReviewerUnapproved
2929 | PRReviewerUpdated
30+ export type PrEventKey = PrEvent [ "eventKey" ]
3031
31- export type PrEventKey =
32- | PRCommentAdded [ "eventKey" ]
33- | PRCommentDeleted [ "eventKey" ]
34- | PRCommentEdited [ "eventKey" ]
35- | PRDeclined [ "eventKey" ]
36- | PRDeleted [ "eventKey" ]
37- | PRFromRefUpdated [ "eventKey" ]
38- | PRMerged [ "eventKey" ]
39- | PRModified [ "eventKey" ]
40- | PROpened [ "eventKey" ]
41- | PRReviewerApproved [ "eventKey" ]
42- | PRReviewerChangesRequested [ "eventKey" ]
43- | PRReviewerUnapproved [ "eventKey" ]
44- | PRReviewerUpdated [ "eventKey" ]
32+ export function isPrEventKey ( key : unknown ) : key is PrEventKey {
33+ return Object . values < unknown > ( prEventKeys ) . includes ( key )
34+ }
35+
36+ export const prEventKeys = {
37+ "pr:comment:added" : "pr:comment:added" ,
38+ "pr:comment:deleted" : "pr:comment:deleted" ,
39+ "pr:comment:edited" : "pr:comment:edited" ,
40+ "pr:declined" : "pr:declined" ,
41+ "pr:deleted" : "pr:deleted" ,
42+ "pr:from_ref_updated" : "pr:from_ref_updated" ,
43+ "pr:merged" : "pr:merged" ,
44+ "pr:modified" : "pr:modified" ,
45+ "pr:opened" : "pr:opened" ,
46+ "pr:reviewer:approved" : "pr:reviewer:approved" ,
47+ "pr:reviewer:changes_requested" : "pr:reviewer:changes_requested" ,
48+ "pr:reviewer:unapproved" : "pr:reviewer:unapproved" ,
49+ "pr:reviewer:updated" : "pr:reviewer:updated" ,
50+ } as const
51+
52+ prEventKeys satisfies Record < PrEventKey , PrEventKey >
0 commit comments