INNER CODE UNIT · TypeScript

configIsValid

peter-evans/slash-command-dispatch · src/command-helper.ts:158

export function configIsValid(config: Command[]): string | null {
  for (const command of config) {
    if (
      !['none', 'read', 'triage', 'write', 'maintain', 'admin'].includes(
        command.permission
      )
    ) {
      return `'${command.permission}' is not a valid 'permission'.`
    }
    if (!['issue', 'pull-request', 'both'].includes(command.issue_type)) {
      return `'${command.issue_type}' is not a valid 'issue-type'.`
    }
    if (!['repository', 'workflow'].includes(command.dispatch_type)) {
      return `'${command.dispatch_type}' is not a valid 'dispatch-type'.`
    }
  }
  return null
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…