add troubleshooting message to openapi script (#17253)

* add troubleshooting message to openapi script

* i always forget to lint
This commit is contained in:
Rachael Sewell 2021-01-16 16:35:10 -08:00 коммит произвёл GitHub
Родитель 4b4235c63a
Коммит 58aae970cf
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -35,7 +35,7 @@ async function main () {
process.exit(1)
}
getDereferencedFiles()
await getDereferencedFiles()
}
await decorate()
@ -58,7 +58,13 @@ async function getDereferencedFiles () {
mkdirp(tempDocsDir)
console.log(`\n🏃🏃🏃Running \`bin/openapi bundle\` in branch '${githubBranch}' of your github/github checkout to generate the dereferenced OpenAPI schema files.\n`)
execSync(`${path.join(githubRepoDir, 'bin/openapi')} bundle ${tempDocsDir}`, { stdio: 'inherit' })
try {
execSync(`${path.join(githubRepoDir, 'bin/openapi')} bundle ${tempDocsDir}`, { stdio: 'inherit' })
} catch (error) {
console.error(error)
console.log('🛑 Whoops! It looks like the `bin/openapi bundle` command failed to run in your `github/github` repository checkout. To troubleshoot, ensure that your OpenAPI schema YAML is formatted correctly. A CI test runs on your `github/github` PR that flags malformed YAML. You can check the PR diff view for comments left by the openapi CI test to find and fix any formatting errors.')
process.exit(1)
}
execSync(`find ${tempDocsDir} -type f -name "*deref.json" -exec mv '{}' ${dereferencedPath} ';'`)