Fix local github checkout bug in openapi sync (#49239)
This commit is contained in:
@@ -65,6 +65,8 @@ program
|
||||
|
||||
const { versions, includeUnpublished, includeDeprecated, next, output, sourceRepo } = program.opts()
|
||||
|
||||
const sourceRepoDirectory = sourceRepo === 'github' ? GITHUB_REP_DIR : REST_API_DESCRIPTION_ROOT
|
||||
|
||||
main()
|
||||
|
||||
async function main() {
|
||||
@@ -122,11 +124,10 @@ async function main() {
|
||||
}
|
||||
const derefFiles = await readdir(TEMP_OPENAPI_DIR)
|
||||
const { restSchemas, webhookSchemas } = await getOpenApiSchemaFiles(derefFiles)
|
||||
const progAccessSource = sourceRepo === 'github' && GITHUB_REP_DIR
|
||||
|
||||
if (pipelines.includes('rest')) {
|
||||
console.log(`\n▶️ Generating REST data files...\n`)
|
||||
await syncRestData(TEMP_OPENAPI_DIR, restSchemas, progAccessSource)
|
||||
await syncRestData(TEMP_OPENAPI_DIR, restSchemas, sourceRepoDirectory)
|
||||
}
|
||||
|
||||
if (pipelines.includes('webhooks')) {
|
||||
@@ -136,7 +137,7 @@ async function main() {
|
||||
|
||||
if (pipelines.includes('github-apps')) {
|
||||
console.log(`\n▶️ Generating GitHub Apps data files...\n`)
|
||||
await syncGitHubAppsData(TEMP_OPENAPI_DIR, restSchemas, progAccessSource)
|
||||
await syncGitHubAppsData(TEMP_OPENAPI_DIR, restSchemas, sourceRepoDirectory)
|
||||
}
|
||||
|
||||
if (pipelines.includes('rest-redirects')) {
|
||||
@@ -236,7 +237,6 @@ async function validateInputParameters() {
|
||||
}
|
||||
|
||||
// Check that the source repo exists.
|
||||
const sourceRepoDirectory = sourceRepo === 'github' ? GITHUB_REP_DIR : REST_API_DESCRIPTION_ROOT
|
||||
if (!existsSync(sourceRepoDirectory)) {
|
||||
const errorMsg =
|
||||
sourceRepo === 'github'
|
||||
|
||||
@@ -16,7 +16,7 @@ const OPENAPI_VERSION_NAMES = Object.keys(allVersions).map(
|
||||
(elem) => allVersions[elem].openApiVersionName,
|
||||
)
|
||||
|
||||
export async function syncRestData(sourceDirectory, restSchemas, progAccessSource = false) {
|
||||
export async function syncRestData(sourceDirectory, restSchemas, progAccessSource) {
|
||||
await Promise.all(
|
||||
restSchemas.map(async (schemaName) => {
|
||||
const file = path.join(sourceDirectory, schemaName)
|
||||
|
||||
Reference in New Issue
Block a user