| const fs = require('fs') | |
| const path = require('path') | |
| const exec = require('child_process').execSync | |
| function loop() { | |
| const dirs = fs.readdirSync('/home/user/app') | |
| for (let dir of dirs) { | |
| if (fs.existsSync(path.join(dir, '.git/config'))) { | |
| console.log('auto commit', dir) | |
| exec(`git add -A`) | |
| exec(`git commit -am "[WIP] auto commit"`) | |
| exec(`git push`) | |
| console.log('done') | |
| } | |
| } | |
| } | |
| setInterval(loop, 600) | |