Skip to content

Commit

Permalink
Allow strict=false parameter for people validator
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Feb 23, 2024
1 parent a21984a commit ba5fa3a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions _tools/people-validator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// This isn't strictly necessary but it enables linking people with the
// various content they're associated with.
//
// Use the --fix=true option to automatically create missing files.
// Use the `--fix=true` option to automatically create missing files.
// Use the `--strict=false` option to output warnings instead of errors.
//
// Note that the name is the only unique identifier for a person. This
// means you can only reference one person for each unique name,
Expand All @@ -24,6 +25,12 @@ let hasUnfixedIssue = false;
let sourcePath = process.env.npm_config_srcdir || argv.srcdir || '.';
if (sourcePath.endsWith('/')) sourcePath.slice(0, -1);

let isStrict = true;
if (("npm_config_strict" in process.env && !process.env.npm_config_strict) ||
process.argv.includes("--strict=false")) {
isStrict = false;
}

let expectedPeople = {};

function recordPostData(data) {
Expand Down Expand Up @@ -93,7 +100,7 @@ function validatePeopleBasedOnPosts() {
processFiles(sourcePath + '/_posts');
validatePeopleBasedOnPosts();

if (hasUnfixedIssue) {
if (hasUnfixedIssue && isStrict) {
// nonzero exit for GitHub Actions
process.exit(1);
}

0 comments on commit ba5fa3a

Please sign in to comment.