From 7991e57b35c9a86cdda880119d9c4ca3b975b4fd Mon Sep 17 00:00:00 2001 From: Cooper Date: Wed, 5 Apr 2023 12:11:01 -0400 Subject: [PATCH] fix(action): refactor a value, add to docs --- README.md | 12 ++++++++++++ src/action.js | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 1aa3e9ee..1715e642 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,18 @@ Whether you want to fail on warnings or not. Default: `false` +### `failOnWarnings` + +Whether you want to fail on warnings or not. + +Default: `false` + +### `failOnErrors` + +Whether you want to fail on errors or not. Still outputs the results, just forces the action to pass even if errors are detected. + +Default: `true` + ### `helpURL` Link to a page explaining your commit message convention. diff --git a/src/action.js b/src/action.js index 1505de1a..d1cf47f9 100644 --- a/src/action.js +++ b/src/action.js @@ -16,8 +16,6 @@ const { GITHUB_EVENT_NAME, GITHUB_SHA } = process.env const configPath = resolve(process.env.GITHUB_WORKSPACE, getInput('configFile')) -const failOnErrors = getInput('failOnErrors') - const getCommitDepth = () => { const commitDepthString = getInput('commitDepth') if (!commitDepthString?.trim()) return null @@ -147,7 +145,7 @@ const showLintResults = async ([from, to]) => { if (hasOnlyWarnings(lintedCommits)) { handleOnlyWarnings(formattedResults) - } else if (formattedResults && failOnErrors === 'false') { + } else if (formattedResults && getInput('failOnErrors') === 'false') { // https://github.com/actions/toolkit/tree/master/packages/core#exit-codes // this would be a good place to implement the setNeutral() when it's eventually implimented. // for now it can pass with a check mark.