@@ -18,7 +18,7 @@ const TARGET_EVENTS = [
1818const FILTERED_ACTIONS = [
1919 "labeled" ,
2020 "unlabeled"
21- ] ;
21+ ] as const ;
2222
2323function getActionString ( { type, payload } : RawEvent ) : string {
2424 switch ( type ) {
@@ -31,10 +31,16 @@ function getActionString({ type, payload }: RawEvent): string {
3131 }
3232}
3333
34- function formatIssueString ( { issue } : RawEvent [ "payload" ] ) : string | null {
35- if ( ! issue ) return null ;
36- const { html_url, number, title } = issue ;
37- return `<a href="${ html_url } " rel="noopener noreferrer" title="Go to issue">#${ number } ${ title } </a>` ;
34+ function composeEventUrl ( event : RawEvent ) : string | null {
35+ if ( event . type === "IssuesEvent" && event . payload . issue ) {
36+ const { html_url, number, title } = event . payload . issue ;
37+ return `<a href="${ html_url } " rel="noopener noreferrer" title="Go to issue">#${ number } ${ title } </a> in ` ;
38+ }
39+ if ( event . type === "ForkEvent" && "forkee" in event . payload ) {
40+ const { html_url, full_name } = event . payload . forkee as { html_url : string , full_name : string } ;
41+ return `<a href="${ html_url } " rel="noopener noreferrer" title="Go to forked repository">${ full_name } </a> from ` ;
42+ }
43+ return null ;
3844}
3945
4046interface FeedEvent {
@@ -82,7 +88,7 @@ export const useEventsStore = createGlobalState(() => {
8288 username : event . actor . display_login ?? event . actor . login ,
8389 action : getActionString ( event ) ,
8490 repo : event . repo . name ,
85- eventUrl : event . type === "IssuesEvent" ? formatIssueString ( event . payload ) : undefined
91+ eventUrl : composeEventUrl ( event )
8692 } ;
8793 acc . push ( feedEvent ) ;
8894 }
0 commit comments