Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion src/yaml-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[] {
Expand Down
19 changes: 19 additions & 0 deletions test/validate-yaml.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Loading