File tree Expand file tree Collapse file tree 2 files changed +42
-1
lines changed
script/lib/update-dependency Expand file tree Collapse file tree 2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,14 @@ const path = require('path');
5
5
const { repositoryRootPath } = require ( '../../config' ) ;
6
6
const packageJSON = require ( path . join ( repositoryRootPath , 'package.json' ) ) ;
7
7
const git = simpleGit ( repositoryRootPath ) ;
8
- const { createPR, findPR, addLabel } = require ( './pull-request' ) ;
8
+ const {
9
+ createPR,
10
+ findPR,
11
+ addLabel,
12
+ findOpenPRs,
13
+ checkCIstatus,
14
+ mergePR
15
+ } = require ( './pull-request' ) ;
9
16
const runApmInstall = require ( '../run-apm-install' ) ;
10
17
const {
11
18
makeBranch,
@@ -94,4 +101,22 @@ module.exports = async function() {
94
101
} catch ( ex ) {
95
102
console . log ( ex . message ) ;
96
103
}
104
+
105
+ // merge previous bumps that passed CI requirements
106
+ try {
107
+ const {
108
+ data : { items }
109
+ } = await findOpenPRs ( ) ;
110
+ for ( const { title } of items ) {
111
+ const ref = title . replace ( '⬆️ ' , '' ) . replace ( '@' , '-' ) ;
112
+ const {
113
+ data : { state }
114
+ } = await checkCIstatus ( { ref } ) ;
115
+ if ( state === 'success' ) {
116
+ await mergePR ( { ref } ) ;
117
+ }
118
+ }
119
+ } catch ( ex ) {
120
+ console . log ( ex ) ;
121
+ }
97
122
} ;
Original file line number Diff line number Diff line change @@ -31,6 +31,22 @@ module.exports = {
31
31
q : `${ moduleName } type:pr ${ moduleName } @${ latest } in:title repo:atom/atom head:${ branch } `
32
32
} ) ;
33
33
} ,
34
+ findOpenPRs : async ( ) => {
35
+ return requestWithAuth ( 'GET /search/issues' , {
36
+ q : 'type:pr repo:atom/atom state:open label:"depency ⬆️"'
37
+ } ) ;
38
+ } ,
39
+ checkCIstatus : async ( { ref } ) => {
40
+ return requestWithAuth ( 'GET /repos/:owner/:repo/commits/:ref/status' , {
41
+ ref
42
+ } ) ;
43
+ } ,
44
+ mergePR : async ( { ref } ) => {
45
+ return requestWithAuth ( 'POST /repos/{owner}/{repo}/merges' , {
46
+ base : 'master' ,
47
+ head : ref
48
+ } ) ;
49
+ } ,
34
50
addLabel : async pullRequestNumber => {
35
51
return requestWithAuth ( 'PATCH /repos/:owner/:repo/issues/:issue_number' , {
36
52
labels : [ 'depency ⬆️' ] ,
You can’t perform that action at this time.
0 commit comments