Skip to content

Instantly share code, notes, and snippets.

@DEGoodmanWilson
Last active August 11, 2019 19:20
Show Gist options
  • Save DEGoodmanWilson/90a209a16d7fe700f60c5d25fd0a95c4 to your computer and use it in GitHub Desktop.
Save DEGoodmanWilson/90a209a16d7fe700f60c5d25fd0a95c4 to your computer and use it in GitHub Desktop.
Snippets for Craftwork
var recastai = require('recastai').default
// You can get a token from https://recast.ai now officially known as SAP Conversational AI!
// Don't forget to add it to the .env file!
var request = new recastai.request(process.env.RECASTAI_TOKEN)
.then(function(result) {
})
.catch(function(err) {
// Handle error
app.log(err)
})
// Is this an assertion, a question, or a command.
if(result.isAssert()) {
// This is an assertion. Let's file this as a bug report
var label = 'bug'
}
else if (result.isCommand()) {
// This is a command. Let's file this as a feature request
var label = 'enhancement'
}
else if (result.isWhQuery() || res.isYnQuery()) {
// This is a question, let's label it as such
var label = 'question'
}
if(label) {
let params = context.issue({
labels: [label]
})
context.github.issues.addLabels(params)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment