1
0
mirror of synced 2025-12-31 06:02:42 -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

@@ -15,7 +15,7 @@ import { validateJson } from '#src/tests/lib/validate-json-schema.js'
const ENABLED_APPS_DIR = 'src/github-apps/data'
const CONFIG_FILE = 'src/github-apps/lib/config.json'
export async function syncGitHubAppsData(openApiSource, sourceSchemas, progAccessSource = false) {
export async function syncGitHubAppsData(openApiSource, sourceSchemas, progAccessSource) {
const { progAccessData, progActorResources } = await getProgAccessData(progAccessSource)
for (const schemaName of sourceSchemas) {
@@ -153,9 +153,10 @@ export async function syncGitHubAppsData(openApiSource, sourceSchemas, progAcces
}
}
export async function getProgAccessData(progAccessSource = false) {
export async function getProgAccessData(progAccessSource) {
const useRemoteGitHubFiles = progAccessSource === 'rest-api-description'
// check for required PAT
if (progAccessSource && !process.env.GITHUB_TOKEN) {
if (useRemoteGitHubFiles && !process.env.GITHUB_TOKEN) {
throw new Error(
'Error! You must have the GITHUB_TOKEN environment variable set to access the programmatic access and resource files via the GitHub REST API.',
)
@@ -167,7 +168,7 @@ export async function getProgAccessData(progAccessSource = false) {
const progAccessFilepath = 'config/access_control/programmatic_access.yaml'
const progActorFilepath = 'config/locales/programmatic_actor_fine_grained_resources.en.yml'
if (progAccessSource) {
if (!useRemoteGitHubFiles) {
progAccessDataRaw = yaml.load(
await readFile(path.join(progAccessSource, progAccessFilepath), 'utf8'),
)