diff --git a/action.yml b/action.yml index 5f4cead2..6c7b60db 100644 --- a/action.yml +++ b/action.yml @@ -120,6 +120,9 @@ inputs: CHECK_ONLY_COMMIT_WHEN_DRAFT: description: Whether to check only commits when drafting. required: false + SUPPRESS_ERROR: + description: Whether to suppress git diff error. + required: false outputs: diff: diff --git a/build.json b/build.json index c41e96dc..f6ce4551 100644 --- a/build.json +++ b/build.json @@ -1 +1 @@ -{"owner":"technote-space","repo":"get-diff-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v4.2.1","branch":"gh-actions","tags":["test/v4.2.1","test/v4.2","test/v4"],"updated_at":"2021-08-01T12:36:54.029Z"} \ No newline at end of file +{"owner":"technote-space","repo":"get-diff-action","sha":"FETCH_HEAD","ref":"refs/heads/master","tagName":"test/v4.2.1","branch":"gh-actions","tags":["test/v4.2.1","test/v4.2","test/v4"],"updated_at":"2021-08-01T13:44:39.768Z"} \ No newline at end of file diff --git a/lib/utils/command.js b/lib/utils/command.js index 8759fc7c..0a39b8d2 100644 --- a/lib/utils/command.js +++ b/lib/utils/command.js @@ -32,6 +32,7 @@ const getPatterns = () => github_action_helper_1.Utils.getArrayInput('PATTERNS', const getFiles = () => github_action_helper_1.Utils.getArrayInput('FILES', undefined, ''); const getWorkspace = (relative) => github_action_helper_1.Utils.getBoolValue(core_1.getInput('ABSOLUTE')) ? (path_1.join(github_action_helper_1.Utils.getWorkspace(), relative) + '/') : ''; const getSummaryIncludeFilesFlag = () => github_action_helper_1.Utils.getBoolValue(core_1.getInput('SUMMARY_INCLUDE_FILES')); +const isSuppressGitDiffError = () => github_action_helper_1.Utils.getBoolValue(core_1.getInput('SUPPRESS_ERROR')); const isFilterIgnored = (item, files) => !!(files.length && files.includes(path_1.basename(item))); const isMatched = (item, patterns, options) => !patterns.length || !!multimatch_1.default(item, patterns, options).length; const toAbsolute = (item, workspace) => path_1.join(workspace, item); @@ -107,7 +108,7 @@ const getGitDiff = (logger, context) => __awaiter(void 0, void 0, void 0, functi ] : []), ], cwd: github_action_helper_1.Utils.getWorkspace(), - // suppressError: true, + suppressError: isSuppressGitDiffError(), })).stdout) .map(item => ({ file: item,