|
1 | 1 | import type { Notification } from '../../../typesGitHub'; |
2 | | -import { checkSuiteHandler } from './checkSuite'; |
3 | | -import { commitHandler } from './commit'; |
4 | | -import { defaultHandler } from './default'; |
5 | | -import { discussionHandler } from './discussion'; |
6 | | -import { issueHandler } from './issue'; |
7 | | -import { pullRequestHandler } from './pullRequest'; |
8 | | -import { releaseHandler } from './release'; |
9 | | -import { repositoryDependabotAlertsThreadHandler } from './repositoryDependabotAlertsThread'; |
10 | | -import { repositoryInvitationHandler } from './repositoryInvitation'; |
11 | | -import { repositoryVulnerabilityAlertHandler } from './repositoryVulnerabilityAlert'; |
| 2 | +import { createCheckSuiteHandler } from './checkSuite'; |
| 3 | +import { createCommitHandler } from './commit'; |
| 4 | +import { createDefaultHandler } from './default'; |
| 5 | +import { createDiscussionHandler } from './discussion'; |
| 6 | +import { createIssueHandler } from './issue'; |
| 7 | +import { createPullRequestHandler } from './pullRequest'; |
| 8 | +import { createReleaseHandler } from './release'; |
| 9 | +import { createRepositoryDependabotAlertsThreadHandler } from './repositoryDependabotAlertsThread'; |
| 10 | +import { createRepositoryInvitationHandler } from './repositoryInvitation'; |
| 11 | +import { createRepositoryVulnerabilityAlertHandler } from './repositoryVulnerabilityAlert'; |
12 | 12 | import type { NotificationTypeHandler } from './types'; |
13 | | -import { workflowRunHandler } from './workflowRun'; |
| 13 | +import { createWorkflowRunHandler } from './workflowRun'; |
14 | 14 |
|
15 | 15 | export function createNotificationHandler( |
16 | 16 | notification: Notification, |
17 | 17 | ): NotificationTypeHandler { |
18 | 18 | switch (notification.subject.type) { |
19 | 19 | case 'CheckSuite': |
20 | | - return checkSuiteHandler; |
| 20 | + return createCheckSuiteHandler(notification); |
21 | 21 | case 'Commit': |
22 | | - return commitHandler; |
| 22 | + return createCommitHandler(notification); |
23 | 23 | case 'Discussion': |
24 | | - return discussionHandler; |
| 24 | + return createDiscussionHandler(notification); |
25 | 25 | case 'Issue': |
26 | | - return issueHandler; |
| 26 | + return createIssueHandler(notification); |
27 | 27 | case 'PullRequest': |
28 | | - return pullRequestHandler; |
| 28 | + return createPullRequestHandler(notification); |
29 | 29 | case 'Release': |
30 | | - return releaseHandler; |
| 30 | + return createReleaseHandler(notification); |
31 | 31 | case 'RepositoryDependabotAlertsThread': |
32 | | - return repositoryDependabotAlertsThreadHandler; |
| 32 | + return createRepositoryDependabotAlertsThreadHandler(notification); |
33 | 33 | case 'RepositoryInvitation': |
34 | | - return repositoryInvitationHandler; |
| 34 | + return createRepositoryInvitationHandler(notification); |
35 | 35 | case 'RepositoryVulnerabilityAlert': |
36 | | - return repositoryVulnerabilityAlertHandler; |
| 36 | + return createRepositoryVulnerabilityAlertHandler(notification); |
37 | 37 | case 'WorkflowRun': |
38 | | - return workflowRunHandler; |
| 38 | + return createWorkflowRunHandler(notification); |
39 | 39 | default: |
40 | | - return defaultHandler; |
| 40 | + return createDefaultHandler(notification); |
41 | 41 | } |
42 | 42 | } |
43 | | - |
44 | | -export const handlers = { |
45 | | - checkSuiteHandler, |
46 | | - commitHandler, |
47 | | - discussionHandler, |
48 | | - issueHandler, |
49 | | - pullRequestHandler, |
50 | | - releaseHandler, |
51 | | - repositoryDependabotAlertsThreadHandler, |
52 | | - repositoryInvitationHandler, |
53 | | - repositoryVulnerabilityAlertHandler, |
54 | | - workflowRunHandler, |
55 | | - defaultHandler, |
56 | | -}; |
0 commit comments