Skip to content

Commit

Permalink
Changes to support validating PR branches
Browse files Browse the repository at this point in the history
In order to make this work without potentially running untrusted code,
we need to run the validation scripts from a separate place than the
content being validated.
  • Loading branch information
nylen committed Dec 27, 2017
1 parent 1a30022 commit 5eb4759
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions bin/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,21 @@ const marked = require( 'marked' );
let errorCount = 0;


/**
* Accept an optional directory name where the content files live.
*/
const contentPath = (
process.argv[ 2 ]
? path.resolve( process.argv[ 2 ] )
: path.join( __dirname, '.. ' )
);


/**
* Build list of Markdown files containing company profiles.
*/

const profilesPath = path.join( __dirname, '..', 'company-profiles' );
const profilesPath = path.join( contentPath, 'company-profiles' );
const profileFilenames = fs.readdirSync( profilesPath );


Expand All @@ -24,7 +34,7 @@ const profileFilenames = fs.readdirSync( profilesPath );
const readmeCompanies = [];

const readmeMarkdown = fs.readFileSync(
path.join( __dirname, '..', 'README.md' ),
path.join( contentPath, 'README.md' ),
'utf8'
);

Expand Down

0 comments on commit 5eb4759

Please sign in to comment.