Last active
August 11, 2019 19:20
-
-
Save UncannyBingo/90a209a16d7fe700f60c5d25fd0a95c4 to your computer and use it in GitHub Desktop.
Snippets for Craftwork
This file contains hidden or 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
var recastai = require('recastai').default |
This file contains hidden or 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
// 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) |
This file contains hidden or 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
.then(function(result) { | |
}) |
This file contains hidden or 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
.catch(function(err) { | |
// Handle error | |
app.log(err) | |
}) |
This file contains hidden or 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
// 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' | |
} |
This file contains hidden or 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
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