mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
merge dependency bumps
This commit is contained in:
@@ -5,7 +5,14 @@ const path = require('path');
|
||||
const { repositoryRootPath } = require('../../config');
|
||||
const packageJSON = require(path.join(repositoryRootPath, 'package.json'));
|
||||
const git = simpleGit(repositoryRootPath);
|
||||
const { createPR, findPR, addLabel } = require('./pull-request');
|
||||
const {
|
||||
createPR,
|
||||
findPR,
|
||||
addLabel,
|
||||
findOpenPRs,
|
||||
checkCIstatus,
|
||||
mergePR
|
||||
} = require('./pull-request');
|
||||
const runApmInstall = require('../run-apm-install');
|
||||
const {
|
||||
makeBranch,
|
||||
@@ -94,4 +101,22 @@ module.exports = async function() {
|
||||
} catch (ex) {
|
||||
console.log(ex.message);
|
||||
}
|
||||
|
||||
// merge previous bumps that passed CI requirements
|
||||
try {
|
||||
const {
|
||||
data: { items }
|
||||
} = await findOpenPRs();
|
||||
for (const { title } of items) {
|
||||
const ref = title.replace('⬆️ ', '').replace('@', '-');
|
||||
const {
|
||||
data: { state }
|
||||
} = await checkCIstatus({ ref });
|
||||
if (state === 'success') {
|
||||
await mergePR({ ref });
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -31,6 +31,22 @@ module.exports = {
|
||||
q: `${moduleName} type:pr ${moduleName}@${latest} in:title repo:atom/atom head:${branch}`
|
||||
});
|
||||
},
|
||||
findOpenPRs: async () => {
|
||||
return requestWithAuth('GET /search/issues', {
|
||||
q: 'type:pr repo:atom/atom state:open label:"depency ⬆️"'
|
||||
});
|
||||
},
|
||||
checkCIstatus: async ({ ref }) => {
|
||||
return requestWithAuth('GET /repos/:owner/:repo/commits/:ref/status', {
|
||||
ref
|
||||
});
|
||||
},
|
||||
mergePR: async ({ ref }) => {
|
||||
return requestWithAuth('POST /repos/{owner}/{repo}/merges', {
|
||||
base: 'master',
|
||||
head: ref
|
||||
});
|
||||
},
|
||||
addLabel: async pullRequestNumber => {
|
||||
return requestWithAuth('PATCH /repos/:owner/:repo/issues/:issue_number', {
|
||||
labels: ['depency ⬆️'],
|
||||
|
||||
Reference in New Issue
Block a user