1
0
mirror of synced 2025-12-22 03:16:52 -05:00

Pipelines webhook data dir (#34775)

This commit is contained in:
Rachael Sewell
2023-02-15 10:43:55 -08:00
committed by GitHub
parent f95d515829
commit 8babc127b2
11 changed files with 9 additions and 11456 deletions

View File

@@ -6,11 +6,10 @@ import { slug } from 'github-slugger'
import { allVersions } from '../../../../lib/all-versions.js'
import { categoriesWithoutSubcategories } from '../../lib/index.js'
import getOperations, { getWebhooks } from './get-operations.js'
import { WEBHOOK_DATA_DIR, WEBHOOK_SCHEMA_FILENAME } from '../../../webhooks/lib/index.js'
const ENABLED_APPS = 'src/github-apps/data/enabled-for-apps.json'
const STATIC_REDIRECTS = 'lib/redirects/static/client-side-rest-api-redirects.json'
const REST_DECORATED_DIR = 'src/rest/data'
const WEBHOOK_DECORATED_DIR = 'src/webhooks/data'
const REST_DEREFERENCED_DIR = 'src/rest/data/dereferenced'
export async function decorate(schemas) {
@@ -216,11 +215,11 @@ async function createStaticWebhookFiles(webhookSchemas) {
}
})
const webhooksFilename = path
.join(WEBHOOK_DECORATED_DIR, `${schemaName}.json`)
.join(WEBHOOK_DATA_DIR, schemaName, WEBHOOK_SCHEMA_FILENAME)
.replace('.deref', '')
if (Object.keys(categorizedWebhooks).length > 0) {
if (!existsSync(WEBHOOK_DECORATED_DIR)) {
mkdirSync(WEBHOOK_DECORATED_DIR)
if (!existsSync(`${WEBHOOK_DATA_DIR}/${schemaName}`)) {
mkdirSync(`${WEBHOOK_DATA_DIR}/${schemaName}`)
}
await writeFile(webhooksFilename, JSON.stringify(categorizedWebhooks, null, 2))
console.log('Wrote', path.relative(process.cwd(), webhooksFilename))