diff --git a/action.yml b/action.yml index 28ea1917..59e356ed 100644 --- a/action.yml +++ b/action.yml @@ -40,6 +40,10 @@ inputs: description: Env name (diff). default: GIT_DIFF required: false + SET_ENV_NAME_FILTERED_DIFF: + description: Env name (filtered_diff). + default: GIT_DIFF_FILTERED + required: false SET_ENV_NAME_COUNT: description: Env name (count). required: false @@ -56,6 +60,8 @@ inputs: outputs: diff: description: The results of diff file names. + filtered_diff: + description: The results of diff file names. count: description: The number of diff files. insertions: diff --git a/build.json b/build.json index bcdd42d8..d79042c8 100644 --- a/build.json +++ b/build.json @@ -1 +1 @@ -{"owner":"technote-space","repo":"get-diff-action","sha":"0bb20ccb30cc7f74b76df6fc2bb3d76f5f0e550f","ref":"refs/tags/test/v1.1.7.40990476","tagName":"test/v1.1.7.40990476","branch":"gh-actions","tags":["test/v1.1.7.40990476","test/v1.1.7","test/v1.1","test/v1"],"updated_at":"2020-02-18T03:04:14.642Z"} \ No newline at end of file +{"owner":"technote-space","repo":"get-diff-action","sha":"c05e1b89edb902368c01e5192d038eaee79294fe","ref":"refs/tags/test/v1.1.7.1","tagName":"test/v1.1.7.1","branch":"gh-actions","tags":["test/v1.1.7.1","test/v1.1.7","test/v1.1","test/v1"],"updated_at":"2020-02-18T13:46:42.184Z"} \ No newline at end of file diff --git a/lib/process.js b/lib/process.js index 3eb4b55a..aebbd094 100644 --- a/lib/process.js +++ b/lib/process.js @@ -17,12 +17,12 @@ exports.dumpDiffs = (diffs, logger) => { logger.endProcess(); }; exports.setResult = (diffs, logger) => { - const result = command_1.getDiffFiles(diffs); const insertions = command_1.sumResults(diffs, item => item.insertions); const deletions = command_1.sumResults(diffs, item => item.deletions); logger.startProcess('Dump output'); [ - { name: 'diff', value: result, envNameSuffix: '' }, + { name: 'diff', value: command_1.getDiffFiles(diffs, false), envNameSuffix: '' }, + { name: 'filtered_diff', value: command_1.getDiffFiles(diffs, true) }, { name: 'count', value: diffs.length }, { name: 'insertions', value: insertions }, { name: 'deletions', value: deletions }, diff --git a/lib/utils/command.js b/lib/utils/command.js index ade88891..a4a92938 100644 --- a/lib/utils/command.js +++ b/lib/utils/command.js @@ -103,7 +103,7 @@ exports.getGitDiff = (logger, context) => __awaiter(void 0, void 0, void 0, func }), Promise.resolve([]))) .map(item => (Object.assign(Object.assign({}, item), { file: toAbsolute(item.file, workspace) }))); }); -exports.getDiffFiles = (diffs) => misc_1.escape(diffs.map(item => item.file)).join(getSeparator()); +exports.getDiffFiles = (diffs, filter) => misc_1.escape(diffs.filter(item => !filter || item.prefixMatched && item.suffixMatched).map(item => item.file)).join(getSeparator()); exports.sumResults = (diffs, map) => getSummaryIncludeFilesFlag() ? diffs.map(map).reduce((acc, val) => acc + val, 0) : // eslint-disable-line no-magic-numbers diffs.filter(item => !item.filterIgnored).map(map).reduce((acc, val) => acc + val, 0); // eslint-disable-line no-magic-numbers