Last active
May 18, 2018 16:42
-
-
Save scottcorgan/fc62756244effc995d0ee61aead39145 to your computer and use it in GitHub Desktop.
Contributing Doc Review Required
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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