File tree Expand file tree Collapse file tree 4 files changed +28
-12
lines changed Expand file tree Collapse file tree 4 files changed +28
-12
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ "extends": "eslint:recommended",
2
3
"parserOptions": {
3
4
"ecmaVersion": 2017,
4
5
"ecmaFeatures": {
5
6
"experimentalObjectRestSpread": true
6
7
}
7
8
},
9
+ "env": {
10
+ "node": true,
11
+ "es6": true
12
+ },
8
13
"plugins": [
9
14
"prettier"
10
15
],
Original file line number Diff line number Diff line change 4
4
* LICENSE file in the root directory of this source tree.
5
5
*/
6
6
7
+ /* eslint-env jest */
8
+
7
9
const t = require ( 'assert' ) ;
8
10
9
11
test ( 'dummy test' , ( ) => {
Original file line number Diff line number Diff line change @@ -13,17 +13,26 @@ module.exports = robot => {
13
13
async function check ( context ) {
14
14
const { github} = context ;
15
15
const pr = context . payload . pull_request ;
16
- const issues = pr . body . match ( issueRegex ( ) ) ;
17
- const status =
18
- issues === null
19
- ? {
20
- state : 'failure' ,
21
- description : 'PR does not reference an issue' ,
22
- }
23
- : {
24
- state : 'success' ,
25
- description : 'PR references an issue' ,
26
- } ;
16
+
17
+ function hasIssue ( ) {
18
+ const issues = pr . body . match ( issueRegex ( ) ) ;
19
+ if ( issues !== null ) {
20
+ return true ;
21
+ }
22
+ const repo = context . payload . repository . full_name ;
23
+ const urlRegex = new RegExp ( `${ repo } /issues/\\d+` , 'g' ) ;
24
+ return pr . body . match ( urlRegex ) !== null ;
25
+ }
26
+
27
+ const status = hasIssue ( )
28
+ ? {
29
+ state : 'success' ,
30
+ description : 'PR references an issue' ,
31
+ }
32
+ : {
33
+ state : 'failure' ,
34
+ description : 'PR does not reference an issue' ,
35
+ } ;
27
36
28
37
setStatus ( status ) ;
29
38
Original file line number Diff line number Diff line change 13
13
},
14
14
"dependencies" : {
15
15
"issue-regex" : " ^1.0.0" ,
16
- "probot" : " ^0.11 .0"
16
+ "probot" : " ^3.0 .0"
17
17
},
18
18
"devDependencies" : {
19
19
"eslint" : " ^4.8.0" ,
You can’t perform that action at this time.
0 commit comments