feat(commits): initial functionality
This commit is contained in:
parent
d6172b8767
commit
861debb85e
25
src/lib/commits.js
Normal file
25
src/lib/commits.js
Normal file
@ -0,0 +1,25 @@
|
||||
const { exec } = require('child_process')
|
||||
|
||||
module.exports = function (results, cb) {
|
||||
const from = results.lastRelease.gitHead
|
||||
const range = (from ? from + '..' : '') + 'HEAD'
|
||||
|
||||
exec(
|
||||
`git log -E --format=%H==SPLIT==%B==END== ${range}`,
|
||||
(err, stdout) => {
|
||||
if (err) return cb(err)
|
||||
|
||||
cb(null, String(stdout).split('==END==\n')
|
||||
|
||||
.filter((raw) => !!raw.trim())
|
||||
|
||||
.map((raw) => {
|
||||
const data = raw.split('==SPLIT==')
|
||||
return {
|
||||
hash: data[0],
|
||||
message: data[1]
|
||||
}
|
||||
}))
|
||||
}
|
||||
)
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user