diff --git a/full-sync.js b/full-sync.js new file mode 100644 index 00000000..a39f8b46 --- /dev/null +++ b/full-sync.js @@ -0,0 +1,19 @@ +const { createProbot } = require('probot') +const appFn = require('./') + +const probot = createProbot() +probot.log.info('Starting full sync.') +const app = appFn(probot, {}) +app.syncInstallation() + .then(settings => { + if (settings.errors.length > 0) { + probot.log.error('Errors occurred during full sync.') + process.exit(1) + } else { + probot.log.info('Done with full sync.') + } + }) + .catch(error => { + process.stdout.write(`Unexpected error during full sync: ${error}\n`) + process.exit(1) + }) diff --git a/lib/settings.js b/lib/settings.js index 961aa4c6..05ddcbe4 100644 --- a/lib/settings.js +++ b/lib/settings.js @@ -22,6 +22,7 @@ class Settings { settings.logError(error.message) await settings.handleResults() } + return settings } static async syncSubOrgs (nop, context, suborg, repo, config, ref) { diff --git a/package.json b/package.json index dbad5350..a923feb2 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "scripts": { "dev": "nodemon --inspect", "start": "probot run ./index.js", + "full-sync": "node ./full-sync.js", "test": "npm-run-all --print-label --parallel lint:* --parallel test:*", "lint:es": "eslint .", "lint:js": "standard",