1
1
const { PR_NUMBER , PR_TITLE , AREAS } = require ( "./constants" )
2
2
3
3
module . exports = async ( { github, context, core} ) => {
4
- const FEAT_REGEX = / f e a t ( \( ( .+ ) \) ) ? ( \ : .+ ) /
5
- const BUG_REGEX = / ( f i x | b u g ) ( \( ( .+ ) \) ) ? ( \ : .+ ) /
6
- const DOCS_REGEX = / ( d o c s | d o c ) ( \( ( .+ ) \) ) ? ( \ : .+ ) /
7
- const CHORE_REGEX = / ( c h o r e ) ( \( ( .+ ) \) ) ? ( \ : .+ ) /
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 ) ( \( ( .+ ) \) ) ? ( \ : .+ ) /
4
+ const FEAT_REGEX = / f e a t ( \( ( .+ ) \) ) ? ( : .+ ) /
5
+ const BUG_REGEX = / ( f i x | b u g ) ( \( ( .+ ) \) ) ? ( : .+ ) /
6
+ const DOCS_REGEX = / ( d o c s | d o c ) ( \( ( .+ ) \) ) ? ( : .+ ) /
7
+ const CHORE_REGEX = / ( c h o r e ) ( \( ( .+ ) \) ) ? ( : .+ ) /
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
10
11
11
const labels = {
12
12
"feature" : FEAT_REGEX ,
@@ -22,8 +22,8 @@ module.exports = async ({github, context, core}) => {
22
22
try {
23
23
for ( const label in labels ) {
24
24
const matcher = new RegExp ( labels [ label ] )
25
- const isMatch = matcher . exec ( PR_TITLE )
26
- if ( isMatch != null ) {
25
+ const matches = matcher . exec ( PR_TITLE )
26
+ if ( matches != null ) {
27
27
core . info ( `Auto-labeling PR ${ PR_NUMBER } with ${ label } ` )
28
28
29
29
await github . rest . issues . addLabels ( {
@@ -54,7 +54,7 @@ module.exports = async ({github, context, core}) => {
54
54
}
55
55
} finally {
56
56
if ( miss == Object . keys ( labels ) . length ) {
57
- return core . notice ( `PR ${ PR_NUMBER } title '${ PR_TITLE } ' doesn't follow semantic titles; skipping...` )
57
+ core . notice ( `PR ${ PR_NUMBER } title '${ PR_TITLE } ' doesn't follow semantic titles; skipping...` )
58
58
}
59
59
}
60
60
}
0 commit comments