1
- const { PR_NUMBER , PR_TITLE , AREAS } = require ( "./constants" ) ;
1
+ const { PR_NUMBER , PR_TITLE } = require ( "./constants" ) ;
2
2
3
3
module . exports = async ( { github, context, core} ) => {
4
- const FEAT_REGEX = / f e a t ( \( ( .+ ) \) ) ? ( : .+ ) /
5
4
const BUG_REGEX = / ( f i x | b u g ) ( \( ( .+ ) \) ) ? ( : .+ ) /
5
+ const FEAT_REFACTOR_REGEX = / ( f e a t | r e f a c t o r ) ( \( ( .+ ) \) ) ? ( : .+ ) /
6
6
const DOCS_REGEX = / ( d o c s | d o c ) ( \( ( .+ ) \) ) ? ( : .+ ) /
7
7
const CHORE_REGEX = / ( c h o r e ) ( \( ( .+ ) \) ) ? ( : .+ ) /
8
8
const DEPRECATED_REGEX = / ( d e p r e c a t e d ) ( \( ( .+ ) \) ) ? ( : .+ ) /
9
- const REFACTOR_REGEX = / ( r e f a c t o r ) ( \( ( .+ ) \) ) ? ( : .+ ) /
10
-
9
+
11
10
const labels = {
12
- "feature" : FEAT_REGEX ,
13
- "bug" : BUG_REGEX ,
14
- "documentation" : DOCS_REGEX ,
15
- "internal" : CHORE_REGEX ,
16
- "enhancement" : REFACTOR_REGEX ,
17
- "deprecated" : DEPRECATED_REGEX ,
18
- } ;
11
+ "type/feature" : FEAT_REFACTOR_REGEX ,
12
+ "type/bug" : BUG_REGEX ,
13
+ "area/documentation" : DOCS_REGEX ,
14
+ "type/internal" : CHORE_REGEX ,
15
+ "type/deprecation" : DEPRECATED_REGEX ,
16
+ }
19
17
20
18
// Maintenance: We should keep track of modified PRs in case their titles change
21
19
let miss = 0 ;
@@ -33,19 +31,6 @@ module.exports = async ({github, context, core}) => {
33
31
labels : [ label ]
34
32
} ) ;
35
33
36
- const area = matches [ 2 ] ; // second capture group contains the area
37
- if ( AREAS . indexOf ( area ) > - 1 ) {
38
- core . info ( `Auto-labeling PR ${ PR_NUMBER } with area ${ area } ` ) ;
39
- await github . rest . issues . addLabels ( {
40
- issue_number : PR_NUMBER ,
41
- owner : context . repo . owner ,
42
- repo : context . repo . repo ,
43
- labels : [ `area/${ area } ` ] ,
44
- } ) ;
45
- } else {
46
- core . debug ( `'${ PR_TITLE } ' didn't match any known area.` ) ;
47
- }
48
-
49
34
return ;
50
35
} else {
51
36
core . debug ( `'${ PR_TITLE } ' didn't match '${ label } ' semantic.` ) ;
0 commit comments