From 3559d7d304b40cda20e697472e6d501f584d96f1 Mon Sep 17 00:00:00 2001 From: Wagner Santos Date: Tue, 8 Oct 2019 10:43:49 -0300 Subject: [PATCH] fix: do not call `require` in the config file to allow other file types --- run.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/run.js b/run.js index e3487da..48ba95a 100644 --- a/run.js +++ b/run.js @@ -1,4 +1,4 @@ -const { existsSync } = require('fs') +const { existsSync, readFileSync } = require('fs') const { resolve } = require('path') const core = require('@actions/core') const github = require('@actions/github') @@ -31,7 +31,9 @@ const getRangeFromPullRequest = async () => { const showLintResults = async ([from, to]) => { const commits = await read({ from, to }) - const config = existsSync(configPath) ? await load(require(configPath)) : {} + const config = existsSync(configPath) + ? await load({}, { file: configPath }) + : {} const results = await Promise.all( commits.map(commit => lint(commit, config.rules)), )