mirror of
https://github.com/wagoid/commitlint-github-action.git
synced 2025-11-07 08:06:54 +00:00
fix: do not call require in the config file to allow other file types
This commit is contained in:
parent
d92577a12c
commit
3559d7d304
1 changed files with 4 additions and 2 deletions
6
run.js
6
run.js
|
|
@ -1,4 +1,4 @@
|
||||||
const { existsSync } = require('fs')
|
const { existsSync, readFileSync } = require('fs')
|
||||||
const { resolve } = require('path')
|
const { resolve } = require('path')
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
const github = require('@actions/github')
|
const github = require('@actions/github')
|
||||||
|
|
@ -31,7 +31,9 @@ const getRangeFromPullRequest = async () => {
|
||||||
|
|
||||||
const showLintResults = async ([from, to]) => {
|
const showLintResults = async ([from, to]) => {
|
||||||
const commits = await read({ 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(
|
const results = await Promise.all(
|
||||||
commits.map(commit => lint(commit, config.rules)),
|
commits.map(commit => lint(commit, config.rules)),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue