You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Decorate the dereferenced files in a format ingestible by docs.github.com
awaitdecorate(schemas)
console.log(
'\n🏁 The static REST API files are now up-to-date with your local `github/github` checkout. To revert uncommitted changes, run `git checkout lib/rest/static/*`.\n\n'
)
if(!keepDereferencedFiles){
rimraf.sync(DOCS_DEREF_OPENAPI_DIR)
}
}
asyncfunctiongetBundledFiles(){
// Get the github/github repo branch name and pull latest
// Only pull master branch because development mode branches are assumed
// to be up-to-date during active work.
if(githubBranch==='master'){
execSync('git pull',{cwd: GITHUB_REP_DIR})
}
// Create a tmp directory to store schema files generated from github/github
rimraf.sync(TEMP_DOCS_DIR)
awaitmkdirp(TEMP_DOCS_DIR)
console.log(
`\n🏃♀️🏃🏃♀️Running \`bin/openapi bundle\` in branch '${githubBranch}' of your github/github checkout to generate the dereferenced OpenAPI schema files.\n`
)
// Format the command supplied to the bundle script in `github/github`
'🛑 Whoops! It looks like the `bin/openapi bundle` command failed to run in your `github/github` repository checkout.\n\n✅ Troubleshooting:\n - Make sure you have a codespace with a checkout of `github/github` at the same level as your `github/docs-internal` repo before running this script. See this documentation for details: https://thehub.github.com/epd/engineering/products-and-services/public-apis/rest/openapi/openapi-in-the-docs/#previewing-changes-in-the-docs.\n - 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.\n\n'
thrownewError(errorMsg)
}
// Moving the dereferenced files to the docs directory creates a consistent
// place to generate the decorated files from. This is where they will be
// delivered in automated pull requests and because of that we move them
consterrorMsg=`🛑 You cannot use the versions option with the include-unpublished or include-deprecated options. This is not currently supported in the bundler.\nYou cannot use the decorate-only option with include-unpublished or include-deprecated because the include-unpublished and include-deprecated options are only available when running the bundler. The decorate-only option skips running the bundler.\nPlease reach out to #docs-engineering if a new use case should be supported.`
thrownewError(errorMsg)
}
// Check that the github/github repo exists. If the files are only being
// decorated, the github/github repo isn't needed.
if(!decorateOnly){
try{
awaitstat(GITHUB_REP_DIR)
}catch(error){
consterrorMsg=`🛑 The ${GITHUB_REP_DIR} does not exist. Make sure you have a codespace with a checkout of \`github/github\` at the same level as your \`github/docs-internal \`repo before running this script. See this documentation for details: https://thehub.github.com/epd/engineering/products-and-services/public-apis/rest/openapi/openapi-in-the-docs/#previewing-changes-in-the-docs.`