From f2cd9fbc2e30da9d144d960ffbed27d860d99072 Mon Sep 17 00:00:00 2001 From: Aram Karapetyan Date: Tue, 28 Jul 2026 14:53:04 +0400 Subject: [PATCH] fix: ignore hidden YAML directories during validation --- src/yaml-validation.ts | 5 ++++- test/validate-yaml.test.ts | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/yaml-validation.ts b/src/yaml-validation.ts index c23922d..51d265f 100644 --- a/src/yaml-validation.ts +++ b/src/yaml-validation.ts @@ -45,7 +45,10 @@ function readOptionalFile(filePath: string): string { } function shouldSkipDirectory(name: string): boolean { - return ['node_modules', '.git', '.terraform', '_terraform', '_terragrunt', 'dist'].includes(name); + // Infrastructure manifests are never stored in hidden directories. Ignoring + // them prevents repository metadata such as .github/workflows from being + // interpreted as workspace YAML when the repository root is validated. + return name.startsWith('.') || ['node_modules', '_terraform', '_terragrunt', 'dist'].includes(name); } function discoverYamlFiles(yamlDir: string): string[] { diff --git a/test/validate-yaml.test.ts b/test/validate-yaml.test.ts index b1ea645..489c790 100644 --- a/test/validate-yaml.test.ts +++ b/test/validate-yaml.test.ts @@ -169,6 +169,25 @@ describe('yaml validation', () => { expect(result.ok).to.equal(true); expect(result.workspaces).to.have.length(1); }); + + it('ignores non-infrastructure YAML in hidden directories', () => { + fs.writeFileSync(path.join(tmpDir, 'module-a.yaml'), [ + 'source: dasmeta/empty/null', + 'version: 1.2.2', + ].join('\n')); + fs.mkdirSync(path.join(tmpDir, '.github', 'workflows'), { recursive: true }); + fs.writeFileSync(path.join(tmpDir, '.github', 'workflows', 'dependabot.yaml'), [ + 'version: 2', + 'updates: []', + ].join('\n')); + + const result = validateYamlDirectory({ yamlDir: tmpDir }); + const listed = listYamlSetups({ yamlDir: tmpDir }); + + expect(result.ok, result.issues.map(issue => issue.message).join('\n')).to.equal(true); + expect(result.workspaces.map(item => item.path)).to.deep.equal(['module-a']); + expect(listed.setups.map(item => item.path)).to.deep.equal(['module-a']); + }); }); describe('examples', () => {