forked from ubiquity/ubiquibot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessors.ts
More file actions
90 lines (87 loc) · 2.69 KB
/
Copy pathprocessors.ts
File metadata and controls
90 lines (87 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
import { GitHubEvent } from "../types/github-events";
import { Handler, WildCardHandler } from "../types/handlers";
import { assignCommandHandler, closePullRequestForAnIssue } from "./assign/assign-command-handler";
import { checkPullRequests } from "./assign/check-pull-requests";
import { commentCreated } from "./comment/comment-created";
import { issueClosed } from "./comment/handlers/issue-closed";
import { watchLabelChange } from "./label/label";
import { addPenalty } from "./penalty/add-penalty";
import { onLabelChangeSetPricing } from "./pricing/pricing-label";
import { syncPriceLabelsToConfig } from "./pricing/sync-labels-to-config";
import { createDevPoolPR } from "./pull-request/create-devpool-pr";
import { checkModifiedBaseRate } from "./push/check-modified-base-rate";
import { checkTasksToUnassign } from "./wildcard/unassign/check-tasks-to-unassign";
/**
* @dev
* pre and post handlers do not return a message to comment on the issue. their return type MUST BE `void`
* main action MUST return a message to comment on the issue. its return type MUST BE either `string` for plaintext or `LogReturn` for color to signal success, warning, or failure status
* TODO: all MUST receive `Context` as the only parameter
*/
export const processors: Record<string, Handler> = {
[GitHubEvent.ISSUES_OPENED]: {
pre: [],
action: [],
post: [],
},
[GitHubEvent.ISSUES_REOPENED]: {
pre: [],
action: [addPenalty],
post: [],
},
[GitHubEvent.ISSUES_LABELED]: {
pre: [syncPriceLabelsToConfig],
action: [],
post: [onLabelChangeSetPricing],
},
[GitHubEvent.ISSUES_UNLABELED]: {
pre: [syncPriceLabelsToConfig],
action: [],
post: [onLabelChangeSetPricing],
},
[GitHubEvent.ISSUES_ASSIGNED]: {
pre: [],
action: [assignCommandHandler],
post: [],
},
[GitHubEvent.ISSUES_UNASSIGNED]: {
pre: [],
action: [closePullRequestForAnIssue],
post: [],
},
[GitHubEvent.ISSUE_COMMENT_CREATED]: {
pre: [],
action: [commentCreated],
post: [],
},
[GitHubEvent.ISSUE_COMMENT_EDITED]: {
pre: [],
action: [],
post: [],
},
[GitHubEvent.ISSUES_CLOSED]: {
pre: [],
action: [issueClosed],
post: [],
},
[GitHubEvent.PULL_REQUEST_OPENED]: {
pre: [],
action: [checkPullRequests],
post: [],
},
[GitHubEvent.INSTALLATION_CREATED]: {
pre: [],
action: [createDevPoolPR],
post: [],
},
[GitHubEvent.PUSH]: {
pre: [],
action: [],
post: [checkModifiedBaseRate],
},
[GitHubEvent.LABEL_EDITED]: {
pre: [],
action: [watchLabelChange],
post: [],
},
};
export const wildcardProcessors: WildCardHandler[] = [checkTasksToUnassign]; // The handlers which will run after every event