forked from github/safe-settings
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfull-sync.js
More file actions
28 lines (23 loc) · 808 Bytes
/
full-sync.js
File metadata and controls
28 lines (23 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const appFn = require('./')
const { FULL_SYNC_NOP } = require('./lib/env')
const { createProbot } = require('probot')
async function performFullSync (appFn, nop) {
const probot = createProbot()
probot.log.info(`Starting full sync with NOP=${nop}`)
try {
const app = appFn(probot, {})
const settings = await app.syncInstallation(nop)
if (settings.errors && settings.errors.length > 0) {
probot.log.error('Errors occurred during full sync.')
process.exit(1)
}
probot.log.info('Full sync completed successfully.')
} catch (error) {
process.stdout.write(`Unexpected error during full sync: ${error}\n`)
process.exit(1)
}
}
performFullSync(appFn, FULL_SYNC_NOP).catch((error) => {
console.error('Fatal error during full sync:', error)
process.exit(1)
})