Commit 9e1f8a2 1 parent f68df57 commit 9e1f8a2 Copy full SHA for 9e1f8a2
File tree 3 files changed +19
-3
lines changed
3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ export default (app: Probot) => {
12
12
13
13
const pr = await PullRequest . getFromNumber ( context , prNum ) ;
14
14
15
- if ( pr . wip ) return ;
15
+ if ( pr . wip || pr . data . draft ) return ;
16
16
17
17
const suites = (
18
18
await context . octokit . checks . listSuitesForRef ( {
Original file line number Diff line number Diff line change 1
1
import { Probot } from 'probot' ;
2
+
3
+ import { labels } from '../labels.js' ;
2
4
import PullRequest from '../classes/PullRequest.js' ;
3
5
4
6
export default ( app : Probot ) => {
@@ -7,7 +9,7 @@ export default (app: Probot) => {
7
9
8
10
let title = pr . data . title ;
9
11
10
- if ( ! pr . wip ) {
12
+ if ( ! pr . wip && ! pr . data . draft ) {
11
13
title = `[WIP] ${ title } ` ;
12
14
await pr . setTitle ( title ) ;
13
15
}
@@ -36,4 +38,18 @@ export default (app: Probot) => {
36
38
await pr . clearLabels ( ) ;
37
39
}
38
40
} ) ;
41
+
42
+ app . on ( [ 'pull_request.converted_to_draft' ] , async context => {
43
+ const pr = new PullRequest ( context ) ;
44
+ await pr . addLabel ( 'wip' ) ;
45
+ } ) ;
46
+
47
+ app . on ( [ 'pull_request.ready_for_review' ] , async context => {
48
+ const pr = new PullRequest ( context ) ;
49
+
50
+ const title = pr . data . title . replace ( labels . wip . regex ?? '' , '' ) ;
51
+ await pr . setTitle ( title ) ;
52
+
53
+ await pr . addLabel ( 'readyForReview' ) ;
54
+ } ) ;
39
55
} ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ type Label = {
7
7
8
8
export const labels : Record < string , Label > = {
9
9
wip : {
10
- regex : / ^ \[ W I P \] \s / i,
10
+ regex : / ^ \s * ( \ [W I P \] \s * | W I P : \s * | W I P \s + ) + / i,
11
11
name : ':construction: WIP' ,
12
12
color : '#FBCA04' ,
13
13
description : 'Still under development, not yet ready for review' ,
You can’t perform that action at this time.
0 commit comments