Created
April 16, 2017 18:02
-
-
Save dend/ad5d640496c6aeb067e7694850a6533a to your computer and use it in GitHub Desktop.
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
// Let's read the file contents. | |
bot.getContent(file.filename, function(result){ | |
var rawContent = result.content; | |
var decodedContent = Buffer.from(rawContent, 'base64').toString('utf-8'); | |
var parsedContent = yfm.loadFront(decodedContent); | |
var title = parsedContent.title; | |
var isSpec = parsedContent.keywords.toLowerCase().indexOf("spec",0) === 0; | |
if (title && isSpec){ | |
console.log("We have a spec!"); | |
bot.createIssue(title,file.filename,function(result){ | |
console.log(result); | |
decodedContent = decodedContent + '\n\n**Please add review comments on the [spec issue](' + result.html_url + ').**'; | |
var reEncodedContent = new Buffer(decodedContent).toString('base64'); | |
bot.updateFile(reEncodedContent,file.filename,function(output){ | |
console.log(output); | |
}) | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment