1
0
mirror of synced 2026-01-06 06:02:35 -05:00

Fix local github checkout bug in openapi sync (#49239)

This commit is contained in:
Rachael Sewell
2024-02-15 14:07:29 -08:00
committed by GitHub
parent f2c7f77c61
commit 3ab18ce88c
3 changed files with 10 additions and 9 deletions

View File

@@ -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'

View File

@@ -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)