wuffle 0.73.1 → 0.73.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apps/automatic-dev-flow.js +43 -13
- package/lib/apps/issue-filter/IssueFilter.js +50 -0
- package/lib/apps/issue-filter/index.js +5 -0
- package/lib/index.js +2 -2
- package/lib/store.js +2 -0
- package/package.json +2 -3
- package/LICENSE +0 -21
- package/lib/apps/store-filter.js +0 -31
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { filterIssueOrPull } from '../filters.js';
|
|
2
|
+
import { issueIdent } from '../util/meta.js';
|
|
3
|
+
|
|
1
4
|
const DONE = 'DONE';
|
|
2
5
|
const EXTERNAL_CONTRIBUTION = 'EXTERNAL_CONTRIBUTION';
|
|
3
6
|
const IN_PROGRESS = 'IN_PROGRESS';
|
|
@@ -15,13 +18,40 @@ const CHANGES_REQUESTED = 'changes_requested';
|
|
|
15
18
|
* @param {import('./webhook-events/WebhookEvents.js').default} webhookEvents
|
|
16
19
|
* @param {import('./github-issues/GithubIssues.js').default} githubIssues
|
|
17
20
|
* @param {import('../columns.js').default} columns
|
|
21
|
+
* @param {import('./issue-filter/IssueFilter.js').default} issueFilter
|
|
22
|
+
* @param {import('../types.js').Logger } logger
|
|
18
23
|
*/
|
|
19
|
-
export default function(webhookEvents, githubIssues, columns) {
|
|
24
|
+
export default function(webhookEvents, githubIssues, columns, issueFilter, logger) {
|
|
25
|
+
|
|
26
|
+
const log = logger.child({
|
|
27
|
+
name: 'wuffle:automatic-dev-flow'
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
function ifEnabled(webhookHandlerFn) {
|
|
31
|
+
|
|
32
|
+
return (context) => {
|
|
33
|
+
|
|
34
|
+
const payload = context.payload;
|
|
35
|
+
|
|
36
|
+
const issueOrPull = filterIssueOrPull(
|
|
37
|
+
payload.issue || payload.pull_request,
|
|
38
|
+
payload.repository
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
if (issueFilter.isIgnored(issueOrPull)) {
|
|
42
|
+
log.debug({ issue: issueIdent(issueOrPull) }, 'issue matching ignore filter');
|
|
43
|
+
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return webhookHandlerFn(context);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
20
50
|
|
|
21
51
|
webhookEvents.on([
|
|
22
52
|
'issues.closed',
|
|
23
53
|
'pull_request.closed'
|
|
24
|
-
], async (context) => {
|
|
54
|
+
], ifEnabled(async (context) => {
|
|
25
55
|
|
|
26
56
|
const {
|
|
27
57
|
pull_request,
|
|
@@ -31,9 +61,9 @@ export default function(webhookEvents, githubIssues, columns) {
|
|
|
31
61
|
const column = columns.getByState(DONE);
|
|
32
62
|
|
|
33
63
|
await githubIssues.moveIssue(context, issue || pull_request, column);
|
|
34
|
-
});
|
|
64
|
+
}));
|
|
35
65
|
|
|
36
|
-
webhookEvents.on('pull_request.converted_to_draft', async (context) => {
|
|
66
|
+
webhookEvents.on('pull_request.converted_to_draft', ifEnabled(async (context) => {
|
|
37
67
|
|
|
38
68
|
const {
|
|
39
69
|
pull_request
|
|
@@ -47,12 +77,12 @@ export default function(webhookEvents, githubIssues, columns) {
|
|
|
47
77
|
githubIssues.moveIssue(context, pull_request, column),
|
|
48
78
|
githubIssues.moveReferencedIssues(context, pull_request, column)
|
|
49
79
|
]);
|
|
50
|
-
});
|
|
80
|
+
}));
|
|
51
81
|
|
|
52
82
|
webhookEvents.on([
|
|
53
83
|
'pull_request.ready_for_review',
|
|
54
84
|
'pull_request.review_requested'
|
|
55
|
-
], async (context) => {
|
|
85
|
+
], ifEnabled(async (context) => {
|
|
56
86
|
|
|
57
87
|
const {
|
|
58
88
|
pull_request,
|
|
@@ -73,12 +103,12 @@ export default function(webhookEvents, githubIssues, columns) {
|
|
|
73
103
|
githubIssues.moveIssue(context, pull_request, column),
|
|
74
104
|
githubIssues.moveReferencedIssues(context, pull_request, column)
|
|
75
105
|
]);
|
|
76
|
-
});
|
|
106
|
+
}));
|
|
77
107
|
|
|
78
108
|
webhookEvents.on([
|
|
79
109
|
'pull_request.opened',
|
|
80
110
|
'pull_request.reopened'
|
|
81
|
-
], async (context) => {
|
|
111
|
+
], ifEnabled(async (context) => {
|
|
82
112
|
|
|
83
113
|
const {
|
|
84
114
|
pull_request
|
|
@@ -105,9 +135,9 @@ export default function(webhookEvents, githubIssues, columns) {
|
|
|
105
135
|
githubIssues.moveIssue(context, pull_request, column, newAssignee),
|
|
106
136
|
githubIssues.moveReferencedIssues(context, pull_request, column, newAssignee)
|
|
107
137
|
]);
|
|
108
|
-
});
|
|
138
|
+
}));
|
|
109
139
|
|
|
110
|
-
webhookEvents.on('pull_request.edited', async (context) => {
|
|
140
|
+
webhookEvents.on('pull_request.edited', ifEnabled(async (context) => {
|
|
111
141
|
|
|
112
142
|
const {
|
|
113
143
|
pull_request
|
|
@@ -116,9 +146,9 @@ export default function(webhookEvents, githubIssues, columns) {
|
|
|
116
146
|
const column = columns.getIssueColumn(pull_request);
|
|
117
147
|
|
|
118
148
|
await githubIssues.moveReferencedIssues(context, pull_request, column);
|
|
119
|
-
});
|
|
149
|
+
}));
|
|
120
150
|
|
|
121
|
-
webhookEvents.on('pull_request_review.submitted', async (context) => {
|
|
151
|
+
webhookEvents.on('pull_request_review.submitted', ifEnabled(async (context) => {
|
|
122
152
|
|
|
123
153
|
const {
|
|
124
154
|
pull_request,
|
|
@@ -141,7 +171,7 @@ export default function(webhookEvents, githubIssues, columns) {
|
|
|
141
171
|
githubIssues.moveIssue(context, pull_request, column),
|
|
142
172
|
githubIssues.moveReferencedIssues(context, pull_request, column)
|
|
143
173
|
]);
|
|
144
|
-
});
|
|
174
|
+
}));
|
|
145
175
|
|
|
146
176
|
webhookEvents.on('create', async (context) => {
|
|
147
177
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef { { ignoreFilter?: string } } StoreFilterConfig
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* An component that configures the store to filter certain elements,
|
|
7
|
+
* effectively making them invisible to the board and its users.
|
|
8
|
+
*
|
|
9
|
+
* @param { StoreFilterConfig } config
|
|
10
|
+
*
|
|
11
|
+
* @param { import('../../store.js').default } store
|
|
12
|
+
* @param { import('../search/Search.js').default } search
|
|
13
|
+
* @param { import('../../types.js').Logger } logger
|
|
14
|
+
*/
|
|
15
|
+
export default function IssueFilter(config, store, search, logger) {
|
|
16
|
+
|
|
17
|
+
const log = logger.child({
|
|
18
|
+
name: 'wuffle:issue-filter'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @type { import('../search/Search.js').FilterFn }
|
|
23
|
+
*/
|
|
24
|
+
let ignoreFilter = (issue) => false;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if ('ignoreFilter' in config) {
|
|
28
|
+
const ignoreFilterFn = search.buildFilterFn(config.ignoreFilter);
|
|
29
|
+
|
|
30
|
+
if (ignoreFilterFn) {
|
|
31
|
+
ignoreFilter = ignoreFilterFn;
|
|
32
|
+
|
|
33
|
+
store.setIgnoreFilter(ignoreFilter);
|
|
34
|
+
} else {
|
|
35
|
+
log.warn('unparseable <ignoreFilter> - please correct your board configuration');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Figure whether the issue shall be ignored (by ignore filter rules)
|
|
41
|
+
*
|
|
42
|
+
* @param {any} issue
|
|
43
|
+
*
|
|
44
|
+
* @return {boolean} true, if issue shall be ignored
|
|
45
|
+
*/
|
|
46
|
+
this.isIgnored = function(issue) {
|
|
47
|
+
return ignoreFilter(issue);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -19,6 +19,7 @@ const appModules = [
|
|
|
19
19
|
import('./apps/github-checks/index.js'),
|
|
20
20
|
import('./apps/github-reviews/index.js'),
|
|
21
21
|
import('./apps/github-statuses/index.js'),
|
|
22
|
+
import('./apps/issue-filter/index.js'),
|
|
22
23
|
import('./apps/security-context/index.js'),
|
|
23
24
|
import('./apps/user-access/index.js'),
|
|
24
25
|
import('./apps/search/index.js'),
|
|
@@ -27,8 +28,7 @@ const appModules = [
|
|
|
27
28
|
import('./apps/auth-routes/index.js'),
|
|
28
29
|
import('./apps/board-api-routes/index.js'),
|
|
29
30
|
import('./apps/board-routes.js'),
|
|
30
|
-
import('./apps/reindex-store.js')
|
|
31
|
-
import('./apps/store-filter.js')
|
|
31
|
+
import('./apps/reindex-store.js')
|
|
32
32
|
];
|
|
33
33
|
|
|
34
34
|
import loadConfig from './load-config.js';
|
package/lib/store.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wuffle",
|
|
3
|
-
"version": "0.73.
|
|
3
|
+
"version": "0.73.2",
|
|
4
4
|
"description": "A multi-repository task board for GitHub issues",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Nico Rehwaldt",
|
|
@@ -81,6 +81,5 @@
|
|
|
81
81
|
"app.yml",
|
|
82
82
|
"index.js",
|
|
83
83
|
"wuffle.config.example.js"
|
|
84
|
-
]
|
|
85
|
-
"gitHead": "914903ed50d90df9a312a96c47ac66bf002604a9"
|
|
84
|
+
]
|
|
86
85
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019-present Nico Rehwaldt
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
9
|
-
of the Software, and to permit persons to whom the Software is furnished to do
|
|
10
|
-
so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
package/lib/apps/store-filter.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @typedef { { ignoreFilter?: string } } StoreFilterConfig
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* An component that configures the store to filter certain elements,
|
|
7
|
-
* effectively making them invisible to the board and its users.
|
|
8
|
-
*
|
|
9
|
-
* @param { StoreFilterConfig } config
|
|
10
|
-
*
|
|
11
|
-
* @param { import('../store.js').default } store
|
|
12
|
-
* @param { import('./search/Search.js').default } search
|
|
13
|
-
* @param { import('../types.js').Logger } logger
|
|
14
|
-
*/
|
|
15
|
-
export default function StoreFilter(config, store, search, logger) {
|
|
16
|
-
|
|
17
|
-
const log = logger.child({
|
|
18
|
-
name: 'wuffle:store-filter'
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
if ('ignoreFilter' in config) {
|
|
22
|
-
const ignoreFilterFn = search.buildFilterFn(config.ignoreFilter);
|
|
23
|
-
|
|
24
|
-
if (ignoreFilterFn) {
|
|
25
|
-
store.setIgnoreFilter(ignoreFilterFn);
|
|
26
|
-
} else {
|
|
27
|
-
log.warn('unparseable <ignoreFilter> - please correct your board configuration');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
}
|