renovate/app/helpers/github.js

158 lines
3.9 KiB
JavaScript
Raw Normal View History

Move code into github and npm helper libraries commit 8e84875bd5f7e4584d707d88d6850565bb02c79c Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 08:22:21 2017 +0100 Synchronous commit 0f24ea192bcf54aae1264e91a4b6eb98fea55448 Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 07:12:20 2017 +0100 externalise more npm commit 458d60975fc967f1373c81cd0fa28a9717dd9b0b Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:45:08 2017 +0100 Externalise npm commit 5d4f39e72d2977af1fec12d7a0a39d3877e4ad02 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:35:16 2017 +0100 Remove ghGot commit 06898801c1e591d6db9e6ac1e565233af5e9be7e Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:43 2017 +0100 Externalise PR functions commit 0b0e0f781b3384ad57a1df3df7d1089b2c72079a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:25 2017 +0100 Enable verbose commit 4cebf1e0a80d7e14b9704c5fd7e5d0b036b9661a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:23:12 2017 +0100 verbose commit 5a984b91e099cccb5c9dff857a6be07b3b4dedd5 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:22:59 2017 +0100 Change default branch naming commit ab9bc952c81d16be9be57227382dff8d05e73f54 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 13:05:08 2017 +0100 Fix branch matching commit eeecf17e196245964aed5247cf1703619d42b0d4 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:15:16 2017 +0100 Update message commit d27b345c5eb51dcb7e32b903beafe0728e24bfdb Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:09:39 2017 +0100 Refactor file write commit 7f12ef69f456ecd064be5d9851157131222f7700 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:59:24 2017 +0100 Refactor writeFile commit 8c7cc9e6a6c7e398aa60cb828c16ff51f36f2efa Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:39:27 2017 +0100 Refactor getFile commit b4338ade6d29b830ead657267248c93216c2f91d Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:15:02 2017 +0100 refactor commit dc4aeb39dad367844836da7f93e9f167864f6030 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:14:34 2017 +0100 createBranch commit d6a357f609de55d7b934652f30592219391a9884 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:04:04 2017 +0100 Add createBranch commit 11ba4e9f6c2153d7b783670944570cb4968ff718 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:27:08 2017 +0100 Rename commit 7a4be0fde0e070e2149bc4c34397c4903096ac51 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:31 2017 +0100 Externalise some github functions commit e393e92bcc9cb548fac3637644b0330a136f3611 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:19 2017 +0100 Fix error message commit 59fb50656d84491780bc31bab4cb9263a7912c03 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:16:59 2017 +0100 Improve error checks commit bc44b3a0d820ab5756c3b3c746402329e5b52703 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:34:04 2017 +0100 Make base branch configurable commit b9d31776814723d991a226d1ca1b2f39d0d2af85 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:33:44 2017 +0100 Reorder early lines commit b75f9f25cfb86f029b73445aae67b7889ff09b3e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:26:47 2017 +0100 Error if RENOVATE_TOKEN is undefined Closes #11 commit 34e13a70326a71b3ee7f18c12ec3de55b78bcaa1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:43:42 2017 +0100 arrow functions commit 6006db2deae887938bc20a07c93d1a59bd8cd74e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:39:30 2017 +0100 Refactor templates
2017-01-07 07:22:48 +00:00
const ghGot = require('gh-got');
2017-01-11 12:19:59 +00:00
const config = {};
let logger = null;
Move code into github and npm helper libraries commit 8e84875bd5f7e4584d707d88d6850565bb02c79c Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 08:22:21 2017 +0100 Synchronous commit 0f24ea192bcf54aae1264e91a4b6eb98fea55448 Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 07:12:20 2017 +0100 externalise more npm commit 458d60975fc967f1373c81cd0fa28a9717dd9b0b Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:45:08 2017 +0100 Externalise npm commit 5d4f39e72d2977af1fec12d7a0a39d3877e4ad02 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:35:16 2017 +0100 Remove ghGot commit 06898801c1e591d6db9e6ac1e565233af5e9be7e Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:43 2017 +0100 Externalise PR functions commit 0b0e0f781b3384ad57a1df3df7d1089b2c72079a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:25 2017 +0100 Enable verbose commit 4cebf1e0a80d7e14b9704c5fd7e5d0b036b9661a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:23:12 2017 +0100 verbose commit 5a984b91e099cccb5c9dff857a6be07b3b4dedd5 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:22:59 2017 +0100 Change default branch naming commit ab9bc952c81d16be9be57227382dff8d05e73f54 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 13:05:08 2017 +0100 Fix branch matching commit eeecf17e196245964aed5247cf1703619d42b0d4 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:15:16 2017 +0100 Update message commit d27b345c5eb51dcb7e32b903beafe0728e24bfdb Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:09:39 2017 +0100 Refactor file write commit 7f12ef69f456ecd064be5d9851157131222f7700 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:59:24 2017 +0100 Refactor writeFile commit 8c7cc9e6a6c7e398aa60cb828c16ff51f36f2efa Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:39:27 2017 +0100 Refactor getFile commit b4338ade6d29b830ead657267248c93216c2f91d Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:15:02 2017 +0100 refactor commit dc4aeb39dad367844836da7f93e9f167864f6030 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:14:34 2017 +0100 createBranch commit d6a357f609de55d7b934652f30592219391a9884 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:04:04 2017 +0100 Add createBranch commit 11ba4e9f6c2153d7b783670944570cb4968ff718 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:27:08 2017 +0100 Rename commit 7a4be0fde0e070e2149bc4c34397c4903096ac51 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:31 2017 +0100 Externalise some github functions commit e393e92bcc9cb548fac3637644b0330a136f3611 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:19 2017 +0100 Fix error message commit 59fb50656d84491780bc31bab4cb9263a7912c03 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:16:59 2017 +0100 Improve error checks commit bc44b3a0d820ab5756c3b3c746402329e5b52703 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:34:04 2017 +0100 Make base branch configurable commit b9d31776814723d991a226d1ca1b2f39d0d2af85 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:33:44 2017 +0100 Reorder early lines commit b75f9f25cfb86f029b73445aae67b7889ff09b3e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:26:47 2017 +0100 Error if RENOVATE_TOKEN is undefined Closes #11 commit 34e13a70326a71b3ee7f18c12ec3de55b78bcaa1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:43:42 2017 +0100 arrow functions commit 6006db2deae887938bc20a07c93d1a59bd8cd74e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:39:30 2017 +0100 Refactor templates
2017-01-07 07:22:48 +00:00
module.exports = {
2017-01-12 16:04:25 +00:00
init,
initRepo,
// Package File
getPackageFile,
getPackageFileContents,
writePackageFile,
// Branch
createBranch,
// PR
checkForClosedPr,
createPr,
getPr,
updatePr,
};
2017-01-12 16:04:25 +00:00
function init(token, l) {
config.token = token;
logger = l;
}
// Initialize GitHub by getting base branch and SHA
2017-01-12 16:04:25 +00:00
function initRepo(repoName) {
config.repoName = repoName;
2017-01-11 12:19:59 +00:00
return getRepo()
.then(processRepo)
.catch((err) => {
logger.error(`GitHub init error: ${err}`);
throw err;
});
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
function getRepo() {
2017-01-11 12:19:59 +00:00
logger.debug(`Getting repo ${repoName}`);
2017-01-11 06:14:14 +00:00
return ghGot(`repos/${config.repoName}`, { token: config.token })
.then(res => res.body);
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
}
function processRepo(repo) {
2017-01-11 12:19:59 +00:00
logger.debug(`Processing repo ${repoName}`);
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
config.owner = repo.owner.login;
config.defaultBranch = repo.default_branch;
2017-01-10 22:06:25 +00:00
return ghGot(`repos/${config.repoName}/git/refs/head`, {
token: config.token,
}).then((res) => {
// Get the SHA for base branch
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
res.body.forEach((branch) => {
Move code into github and npm helper libraries commit 8e84875bd5f7e4584d707d88d6850565bb02c79c Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 08:22:21 2017 +0100 Synchronous commit 0f24ea192bcf54aae1264e91a4b6eb98fea55448 Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 07:12:20 2017 +0100 externalise more npm commit 458d60975fc967f1373c81cd0fa28a9717dd9b0b Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:45:08 2017 +0100 Externalise npm commit 5d4f39e72d2977af1fec12d7a0a39d3877e4ad02 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:35:16 2017 +0100 Remove ghGot commit 06898801c1e591d6db9e6ac1e565233af5e9be7e Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:43 2017 +0100 Externalise PR functions commit 0b0e0f781b3384ad57a1df3df7d1089b2c72079a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:25 2017 +0100 Enable verbose commit 4cebf1e0a80d7e14b9704c5fd7e5d0b036b9661a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:23:12 2017 +0100 verbose commit 5a984b91e099cccb5c9dff857a6be07b3b4dedd5 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:22:59 2017 +0100 Change default branch naming commit ab9bc952c81d16be9be57227382dff8d05e73f54 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 13:05:08 2017 +0100 Fix branch matching commit eeecf17e196245964aed5247cf1703619d42b0d4 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:15:16 2017 +0100 Update message commit d27b345c5eb51dcb7e32b903beafe0728e24bfdb Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:09:39 2017 +0100 Refactor file write commit 7f12ef69f456ecd064be5d9851157131222f7700 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:59:24 2017 +0100 Refactor writeFile commit 8c7cc9e6a6c7e398aa60cb828c16ff51f36f2efa Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:39:27 2017 +0100 Refactor getFile commit b4338ade6d29b830ead657267248c93216c2f91d Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:15:02 2017 +0100 refactor commit dc4aeb39dad367844836da7f93e9f167864f6030 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:14:34 2017 +0100 createBranch commit d6a357f609de55d7b934652f30592219391a9884 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:04:04 2017 +0100 Add createBranch commit 11ba4e9f6c2153d7b783670944570cb4968ff718 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:27:08 2017 +0100 Rename commit 7a4be0fde0e070e2149bc4c34397c4903096ac51 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:31 2017 +0100 Externalise some github functions commit e393e92bcc9cb548fac3637644b0330a136f3611 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:19 2017 +0100 Fix error message commit 59fb50656d84491780bc31bab4cb9263a7912c03 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:16:59 2017 +0100 Improve error checks commit bc44b3a0d820ab5756c3b3c746402329e5b52703 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:34:04 2017 +0100 Make base branch configurable commit b9d31776814723d991a226d1ca1b2f39d0d2af85 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:33:44 2017 +0100 Reorder early lines commit b75f9f25cfb86f029b73445aae67b7889ff09b3e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:26:47 2017 +0100 Error if RENOVATE_TOKEN is undefined Closes #11 commit 34e13a70326a71b3ee7f18c12ec3de55b78bcaa1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:43:42 2017 +0100 arrow functions commit 6006db2deae887938bc20a07c93d1a59bd8cd74e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:39:30 2017 +0100 Refactor templates
2017-01-07 07:22:48 +00:00
// Loop through all branches because the base branch may not be the first
if (branch.ref === `refs/heads/${config.defaultBranch}`) {
Move code into github and npm helper libraries commit 8e84875bd5f7e4584d707d88d6850565bb02c79c Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 08:22:21 2017 +0100 Synchronous commit 0f24ea192bcf54aae1264e91a4b6eb98fea55448 Author: Rhys Arkins <rhys@keylocation.sg> Date: Sat Jan 7 07:12:20 2017 +0100 externalise more npm commit 458d60975fc967f1373c81cd0fa28a9717dd9b0b Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:45:08 2017 +0100 Externalise npm commit 5d4f39e72d2977af1fec12d7a0a39d3877e4ad02 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:35:16 2017 +0100 Remove ghGot commit 06898801c1e591d6db9e6ac1e565233af5e9be7e Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:43 2017 +0100 Externalise PR functions commit 0b0e0f781b3384ad57a1df3df7d1089b2c72079a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 15:34:25 2017 +0100 Enable verbose commit 4cebf1e0a80d7e14b9704c5fd7e5d0b036b9661a Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:23:12 2017 +0100 verbose commit 5a984b91e099cccb5c9dff857a6be07b3b4dedd5 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 14:22:59 2017 +0100 Change default branch naming commit ab9bc952c81d16be9be57227382dff8d05e73f54 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 13:05:08 2017 +0100 Fix branch matching commit eeecf17e196245964aed5247cf1703619d42b0d4 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:15:16 2017 +0100 Update message commit d27b345c5eb51dcb7e32b903beafe0728e24bfdb Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 11:09:39 2017 +0100 Refactor file write commit 7f12ef69f456ecd064be5d9851157131222f7700 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:59:24 2017 +0100 Refactor writeFile commit 8c7cc9e6a6c7e398aa60cb828c16ff51f36f2efa Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:39:27 2017 +0100 Refactor getFile commit b4338ade6d29b830ead657267248c93216c2f91d Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:15:02 2017 +0100 refactor commit dc4aeb39dad367844836da7f93e9f167864f6030 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:14:34 2017 +0100 createBranch commit d6a357f609de55d7b934652f30592219391a9884 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 10:04:04 2017 +0100 Add createBranch commit 11ba4e9f6c2153d7b783670944570cb4968ff718 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:27:08 2017 +0100 Rename commit 7a4be0fde0e070e2149bc4c34397c4903096ac51 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:31 2017 +0100 Externalise some github functions commit e393e92bcc9cb548fac3637644b0330a136f3611 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:17:19 2017 +0100 Fix error message commit 59fb50656d84491780bc31bab4cb9263a7912c03 Author: Rhys Arkins <rhys@keylocation.sg> Date: Fri Jan 6 07:16:59 2017 +0100 Improve error checks commit bc44b3a0d820ab5756c3b3c746402329e5b52703 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:34:04 2017 +0100 Make base branch configurable commit b9d31776814723d991a226d1ca1b2f39d0d2af85 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:33:44 2017 +0100 Reorder early lines commit b75f9f25cfb86f029b73445aae67b7889ff09b3e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 15:26:47 2017 +0100 Error if RENOVATE_TOKEN is undefined Closes #11 commit 34e13a70326a71b3ee7f18c12ec3de55b78bcaa1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:43:42 2017 +0100 arrow functions commit 6006db2deae887938bc20a07c93d1a59bd8cd74e Author: Rhys Arkins <rhys@keylocation.sg> Date: Thu Jan 5 14:39:30 2017 +0100 Refactor templates
2017-01-07 07:22:48 +00:00
// This is the SHA we will create new branches from
config.baseSHA = branch.object.sha;
}
});
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
return Promise.resolve();
2017-01-07 20:19:15 +00:00
});
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
}
}
// Package File
function getPackageFile(branchName) {
return getFile(config.packageFile, branchName);
}
2017-01-11 12:19:59 +00:00
function getPackageFileContents(packageFile) {
2017-01-12 16:04:25 +00:00
logger.debug(`Retrieving ${config.repoName} ${packageFile}`);
2017-01-11 12:19:59 +00:00
config.packageFile = packageFile;
return getFileContents(config.packageFile);
}
function writePackageFile(branchName, oldFileSHA, fileContents, message) {
2017-01-10 22:06:25 +00:00
return writeFile(
branchName,
oldFileSHA,
config.packageFile,
fileContents,
2017-01-11 06:14:14 +00:00
message);
}
// Branch
function createBranch(branchName) {
return ghGot.post(`repos/${config.repoName}/git/refs`, {
token: config.token,
body: {
ref: `refs/heads/${branchName}`,
sha: config.baseSHA,
},
});
}
// Pull Request
function checkForClosedPr(branchName, prTitle) {
2017-01-10 22:06:25 +00:00
return ghGot(
`repos/${config.repoName}/pulls?state=closed&head=${config.owner}:${branchName}`,
2017-01-11 06:54:27 +00:00
{ token: config.token })
.then(res =>
res.body.some(pr => pr.title === prTitle && pr.head.label === `${config.owner}:${branchName}`))
.catch((error) => {
logger.error(`Error checking if PR already existed: ${error}`);
2017-01-10 22:06:25 +00:00
});
}
function createPr(branchName, title, body) {
2017-01-10 22:06:25 +00:00
return ghGot
.post(`repos/${config.repoName}/pulls`, {
token: config.token,
body: { title, head: branchName, base: config.defaultBranch, body },
})
.then(res => res.body);
}
function getPr(branchName) {
2017-01-10 22:06:25 +00:00
const gotString = `repos/${config.repoName}/pulls?` +
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
`state=open&base=${config.defaultBranch}&head=${config.owner}:${branchName}`;
2017-01-10 22:06:25 +00:00
return ghGot(gotString, { token: config.token }).then((res) => {
if (res.body.length) {
return res.body[0];
}
return null;
});
}
function updatePr(prNo, title, body) {
return ghGot.patch(`repos/${config.repoName}/pulls/${prNo}`, {
token: config.token,
2017-01-10 22:06:25 +00:00
body: { title, body },
});
}
// Generic File operations
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
function getFile(filePath, branchName = config.defaultBranch) {
2017-01-11 06:14:14 +00:00
return ghGot(`repos/${config.repoName}/contents/${filePath}?ref=${branchName}`,
{
2017-01-11 06:54:27 +00:00
token: config.token,
2017-01-11 06:14:14 +00:00
});
2017-01-07 21:08:45 +00:00
}
function getFileContents(filePath, branchName) {
2017-01-11 06:14:14 +00:00
return getFile(filePath, branchName)
.then(res => JSON.parse(new Buffer(res.body.content, 'base64').toString()));
}
function writeFile(branchName, oldFileSHA, filePath, fileContents, message) {
return ghGot.put(`repos/${config.repoName}/contents/${filePath}`, {
token: config.token,
body: {
branch: branchName,
sha: oldFileSHA,
Add eslint Closes #17 commit 12d7e50a818720ff2c44e4e9475eef78a1dc0174 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:27:56 2017 +0100 Update eslintrc commit f583442dcdf7e3180d2da5464693df12f4419152 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:22:15 2017 +0100 Add eslint and config commit 59334f7a7311c451ef7aa4e0759d9c09686e86c6 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 22:20:24 2017 +0100 Refactor promise for linting commit 288f0e753a3d1e93f1b14e3e80692861fab0fff0 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 19:09:48 2017 +0100 Fix more promise lints commit 7f602a149c60da123bc010965ec8be78b3fa7ab1 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:18 2017 +0100 lint github promises commit dd6b78340e5a9c128e83aa87da8e3714e3947e82 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 18:30:10 2017 +0100 lint npm promises commit 5c48c159c7ab89999e7966d93c4b1c9f1179d95d Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:25:13 2017 +0100 Lint packageJson helper commit b440eb83fccdc2c1afbd3e3b74c6798e35b3533f Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:04:56 2017 +0100 Fix github helper lint commit 269c84a2be8a2e9cd495d4f90893eaaccd8a2156 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:48 2017 +0100 Fix typo commit 548ca6c31f3f4417995c65f4466d216a4918387e Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 15:00:29 2017 +0100 Fix npm lint commit f8ea5d5b72745e7cbebad184f46fc3046f57a525 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:56:15 2017 +0100 lint defaults commit 6130092a57d37d62ed8f1274817ce81dfdae84bc Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:52:16 2017 +0100 Finish index commit 9e2b6f5e02fad38904172b40811043a0caab879b Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:40:06 2017 +0100 Fix string concatenation commit 47b7cdac3f0acc6588e403dff3cacfda27789472 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:38:23 2017 +0100 Fix arrow syntax commit 27b8db685f7ee66e914754fd578d421f39656397 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:29:10 2017 +0100 Refactor updateDependency commit 272f012583ac514709c81ffd7a68f50f0b4ed2b3 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 14:15:43 2017 +0100 Refactor ensureCommit commit 1e1ff56d6b94a8ef6a360213715563452a0957e8 Author: Rhys Arkins <rhys@keylocation.sg> Date: Tue Jan 10 13:54:02 2017 +0100 Refactor ensurePr
2017-01-10 21:28:22 +00:00
message,
content: new Buffer(fileContents).toString('base64'),
},
});
}