INNER CODE UNIT · TypeScript
firstLine
peter-evans/slash-command-dispatch · src/main.ts:60
const firstLine = commentBody.split(/\r?\n/)[0].trim()
if (firstLine.length < 2 || firstLine.charAt(0) != '/') {
console.debug(
'The first line of the comment is not a valid slash command.'
)
return
}
// Tokenise the first line (minus the leading slash)
const commandTokens = tokeniseCommand(firstLine.slice(1))
core.debug(`Command tokens: ${inspect(commandTokens)}`)
// Check if the command is registered for dispatch
let configMatches = config.filter(function (cmd) {
return cmd.command == commandTokens[0]
})
core.debug(`Config matches on 'command': ${inspect(configMatches)}`)
if (configMatches.length == 0) {