diff --git a/src/index.js b/src/index.js index c972d34..721ef42 100644 --- a/src/index.js +++ b/src/index.js @@ -47,6 +47,7 @@ async function run() { project.workspace, inputs.fileGlob ); + const rootSpectral = await createSpectral(inputs.spectralRootRuleset); const pathSpectral = await createSpectral(inputs.spectralPathRuleset); const schemaSpectral = await createSpectral(inputs.spectralSchemaRuleset); @@ -67,14 +68,13 @@ async function run() { if (fileContents[i].file.includes(`sailpoint-api.`)) { console.log(`Running root ruleset on ${fileContents[i].file}`); - const rootSpectral = await createSpectral(inputs.spectralRootRuleset); - pbs = await runSpectral(rootSpectral, fileContents[i].content, false); + pbs = await runSpectral(rootSpectral, fileContents[i].content.slice(0), false); } else if (fileContents[i].file.includes(`paths`)) { console.log(`Running path ruleset on ${fileContents[i].file}`); - pbs = await runSpectral(pathSpectral, fileContents[i].content, true); + pbs = await runSpectral(pathSpectral, fileContents[i].content.slice(0), true); } else if (fileContents[i].file.includes(`schema`)) { console.log(`Running schema ruleset on ${fileContents[i].file}`); - pbs = await runSpectral(schemaSpectral, fileContents[i].content, true); + pbs = await runSpectral(schemaSpectral, fileContents[i].content.slice(0), true); } //console.log(`Current Working Directory: ` + process.cwd());