Skip to content

Instantly share code, notes, and snippets.

@scottcorgan
Last active May 18, 2018 16:42
Show Gist options
  • Save scottcorgan/fc62756244effc995d0ee61aead39145 to your computer and use it in GitHub Desktop.
Save scottcorgan/fc62756244effc995d0ee61aead39145 to your computer and use it in GitHub Desktop.
Contributing Doc Review Required
const { execSync } = require('child_process')
const prompt = require('readline-sync')
const DAYS_OF_COMMITS = 30
try {
const email = execSync('git config user.email').toString().split('\n')[0]
const command = `git log --since=${DAYS_OF_COMMITS}.days --oneline --author="${email}"`
const logs = execSync(command).toString().split('\n').filter(log => log !== '')
const docMessage =
'\nPlease review our CONTRIBUTING doc prior to committing your work:\n\nhttps://github.com/someorg/blah/blob/master/CONTRIBUTING.md\n\n'
if (logs.length < 1) {
const didReview = prompt.keyInYN(`${docMessage}Have you reviewed it?`)
if (!didReview) {
console.log(docMessage)
process.exit(1)
}
}
} catch (error) {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment