Skip to content

Commit 2074f6e

Browse files
darangiaminya
authored andcommitted
missing files
1 parent 73a38c6 commit 2074f6e

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

script/lib/update-dependency/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const run = require('./main');
2+
3+
run();
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const { request } = require('@octokit/request');
2+
3+
const requestWithAuth = request.defaults({
4+
baseUrl: 'https://api.github.com',
5+
headers: {
6+
'user-agent': 'atom',
7+
authorization: `token ${process.env.AUTH_TOKEN}`
8+
},
9+
owner: 'atom',
10+
repo: 'atom'
11+
});
12+
13+
module.exports = {
14+
createPR: async (
15+
{ moduleName, isCorePackage, latest, installed },
16+
branch
17+
) => {
18+
let description = `Bumps ${moduleName} from ${installed} to ${latest}`;
19+
if (isCorePackage) {
20+
description = `*List of changes between ${moduleName}@${installed} and ${moduleName}@${latest}: https://github.com/atom/${moduleName}/compare/v${installed}...v${latest}*`;
21+
}
22+
return requestWithAuth('POST /repos/:owner/:repo/pulls', {
23+
title: `⬆️ ${moduleName}@${latest}`,
24+
body: description,
25+
base: 'master',
26+
head: branch
27+
});
28+
},
29+
findPR: async ({ moduleName, latest }, branch) => {
30+
return requestWithAuth('GET /search/issues', {
31+
q: `${moduleName} type:pr ${moduleName}@${latest} in:title repo:atom/atom head:${branch} state:open`
32+
});
33+
},
34+
addLabel: async pullRequestNumber => {
35+
return requestWithAuth('PATCH /repos/:owner/:repo/issues/:issue_number', {
36+
labels: ['depency ⬆️'],
37+
issue_number: pullRequestNumber
38+
});
39+
}
40+
};

0 commit comments

Comments
 (0)