Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions plugins/expo/skills/expo-cicd-workflows/scripts/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ const SCHEMA_URL = 'https://api.expo.dev/v2/workflows/schema';

async function fetchSchema() {
const data = await fetchCached(SCHEMA_URL);
const body = JSON.parse(data);
return body.data;
try {
const body = JSON.parse(data);
if (!body || typeof body.data !== 'object') {
throw new Error('Invalid schema response structure');
}
return body.data;
} catch (e) {
throw new Error(`Failed to parse schema: ${e.message}`);
}
}

function createValidator(schema) {
Expand Down Expand Up @@ -57,9 +64,7 @@ if (import.meta.main) {
const files = args.filter((a) => !a.startsWith('-'));

if (files.length === 0 || args.includes('--help') || args.includes('-h')) {
console.log(`Usage: validate <workflow.yml> [workflow2.yml ...]

Validates EAS workflow YAML files against the official schema.`);
console.log(`Usage: validate <workflow.yml> [workflow2.yml ...]\n\nValidates EAS workflow YAML files against the official schema.`);
process.exit(files.length === 0 ? 1 : 0);
}

Expand Down