Skip to content

Commit

Permalink
testing looping
Browse files Browse the repository at this point in the history
  • Loading branch information
katiegoines committed Jun 10, 2024
1 parent 67a30ea commit 93a09ce
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/scripts/validate-redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module.exports = {
const errors = [];

const validateEntries = (redirects) => {
console.log('running')
const validate = ajv.compile(schema);
const valid = validate(redirects);

Expand All @@ -44,12 +45,12 @@ module.exports = {
JSON.stringify(redirects[error.instancePath.slice(1, -7)]);
const loc = error.schemaPath.slice(error.schemaPath.indexOf('properties') + 11, -8);
const errorMessage = '\n\n' + 'INVALID ENTRY: Please correct the error in the "' + loc +'" property of the following entry: \n' + invalidEntry + '\n\n' + 'ERROR MESSAGE: ' + error.message;

errors.push(errorMessage);

redirects = redirects.splice(error.instancePath.slice(1, -7) + 1);
console.log(errors)


validateEntries(redirects);

} else if (valid && errors.length > 0) {
return JSON.stringify(errors);
}
Expand Down

0 comments on commit 93a09ce

Please sign in to comment.