diff --git a/.github/workflows/validate-structure.yml b/.github/workflows/validate-structure.yml index df2d8658..49795b62 100644 --- a/.github/workflows/validate-structure.yml +++ b/.github/workflows/validate-structure.yml @@ -77,5 +77,7 @@ jobs: Please check the CI logs above for specific error details and fix the issues before merging. - 📖 See the [validation documentation](docs/folder-format.md) for more details.` + 📖 See the [validation documentation](docs/folder-format.md) for more details. + + To disable the validation check please add a validation.yml file to your upgrade folder with 'disabled': true` }) diff --git a/validation-tool-interface/package-lock.json b/validation-tool-interface/package-lock.json index e0849432..0676bc81 100644 --- a/validation-tool-interface/package-lock.json +++ b/validation-tool-interface/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "next": "^14.2.30", "react": "^18.2.0", + "yaml": "^2.8.1", "zod": "^3.22.4" }, "devDependencies": { @@ -10026,6 +10027,17 @@ "dev": true, "license": "ISC" }, + "node_modules/yaml": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.1.tgz", + "integrity": "sha512-lcYcMxX2PO9XMGvAJkJ3OsNMw+/7FKes7/hgerGUYWIoWu5j/+YQqcZr5JnPZWzOsEBgMbSbiSTn/dv/69Mkpw==", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14.6" + } + }, "node_modules/yargs": { "version": "17.7.2", "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", diff --git a/validation-tool-interface/package.json b/validation-tool-interface/package.json index d9bd8423..e1034cc7 100644 --- a/validation-tool-interface/package.json +++ b/validation-tool-interface/package.json @@ -16,6 +16,7 @@ "dependencies": { "next": "^14.2.30", "react": "^18.2.0", + "yaml": "^2.8.1", "zod": "^3.22.4" }, "devDependencies": { diff --git a/validation-tool-interface/scripts/validate-structure.ts b/validation-tool-interface/scripts/validate-structure.ts index 8181b9fe..a1350fb4 100644 --- a/validation-tool-interface/scripts/validate-structure.ts +++ b/validation-tool-interface/scripts/validate-structure.ts @@ -4,6 +4,7 @@ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; import { ConfigParser } from '../utils/parser'; +import { parse as yamlParse } from "yaml"; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -26,6 +27,10 @@ interface InvalidFile { errors: Array<{ message: string }>; } +interface ValidationConfig { + disabled: bool; +} + export class StructureValidator { private errors: ValidationError[] = []; private warnings: ValidationWarning[] = []; @@ -101,6 +106,26 @@ export class StructureValidator { return; } + // Check if there is a validation configuration file + const validationsConfigFileYml = path.join(absolutePath, 'validation.yml'); + const validationsConfigFileYaml = path.join(absolutePath, 'validation.yaml'); + let configContent: string | undefined; + if (fs.existsSync(validationsConfigFileYml)) { + configContent = fs.readFileSync(validationsConfigFileYml, 'utf-8'); + } + + if (fs.existsSync(validationsConfigFileYaml)) { + configContent = fs.readFileSync(validationsConfigFileYaml, 'utf-8'); + } + + if (configContent !== undefined) { + const config = yamlParse(configContent) as ValidationConfig; + if (config.disabled) { + console.log('Validation check is disabled.'); + return; + } + } + // Check if validations subdirectory exists const validationsPath = path.join(absolutePath, 'validations'); if (!fs.existsSync(validationsPath)) {