9
9
Notification ,
10
10
PullRequest ,
11
11
PullRequestStateType ,
12
+ ReleaseComments ,
12
13
User ,
13
14
WorkflowRunAttributes ,
14
15
} from '../typesGithub' ;
@@ -27,6 +28,8 @@ export async function getGitifySubjectDetails(
27
28
return await getGitifySubjectForIssue ( notification , token ) ;
28
29
case 'PullRequest' :
29
30
return await getGitifySubjectForPullRequest ( notification , token ) ;
31
+ case 'Release' :
32
+ return await getGitifySubjectForRelease ( notification , token ) ;
30
33
case 'WorkflowRun' :
31
34
return getGitifySubjectForWorkflowRun ( notification ) ;
32
35
default :
@@ -156,6 +159,18 @@ async function getGitifySubjectForPullRequest(
156
159
} ;
157
160
}
158
161
162
+ async function getGitifySubjectForRelease (
163
+ notification : Notification ,
164
+ token : string ,
165
+ ) : Promise < GitifySubject > {
166
+ const releaseCommentUser = await getLatestCommentUser ( notification , token ) ;
167
+
168
+ return {
169
+ state : null ,
170
+ user : releaseCommentUser . login ,
171
+ } ;
172
+ }
173
+
159
174
function getGitifySubjectForWorkflowRun (
160
175
notification : Notification ,
161
176
) : GitifySubject {
@@ -203,9 +218,11 @@ async function getLatestCommentUser(
203
218
notification : Notification ,
204
219
token : string ,
205
220
) : Promise < User > {
206
- const response : IssueComments = (
221
+ const response : IssueComments | ReleaseComments = (
207
222
await apiRequestAuth ( notification . subject . latest_comment_url , 'GET' , token )
208
223
) . data ;
209
224
210
- return response . user ;
225
+ return (
226
+ ( response as IssueComments ) . user ?? ( response as ReleaseComments ) . author
227
+ ) ;
211
228
}
0 commit comments