Merge pull request #1601 from tj-actions/feat/add-support-for-restricting-the-deleted-files-output-to-only-deleted-directories

This commit is contained in:
Tonye Jack 2023-09-22 13:45:16 -06:00 committed by GitHub
commit aaf4339aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 170 additions and 22 deletions

View File

@ -811,7 +811,81 @@ jobs:
else else
cat "deleted_files/test/test deleted.txt" cat "deleted_files/test/test deleted.txt"
fi fi
test-dir-names-deleted-files-include-only-deleted-dirs-single-file:
name: Test dir names deleted files include only deleted dirs single file
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: a52f8621d26d5d9f54b80f74bda2d9eedff94693
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 2
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with a single file deleted withing the test directory
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file
uses: ./
with:
base_sha: 920856cfdd4b4be17810e34b197596397473adf6
sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
dir_names: true
dir_names_deleted_files_include_only_deleted_dirs: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs) }}'
shell:
bash
- name: Check deleted_files output
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs.deleted_files != ''
run: |
echo "Invalid output: Expected '' got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-single-file.outputs.deleted_files }})"
exit 1
shell:
bash
test-dir-names-deleted-files-include-only-deleted-dirs-directory:
name: Test dir names deleted files include only deleted dirs
runs-on: ubuntu-latest
needs: build
if: needs.build.outputs.files_changed != 'true'
steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
ref: cd1e384723e4d1a184568182ac2b27c53ebf017f
repository: ${{ github.event.pull_request.head.repo.full_name }}
submodules: true
fetch-depth: 2
- name: Run changed-files with dir_names and dir_names_deleted_files_include_only_deleted_dirs with the test directory deleted
id: changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory
uses: ./
with:
base_sha: a52f8621d26d5d9f54b80f74bda2d9eedff94693
sha: cd1e384723e4d1a184568182ac2b27c53ebf017f
dir_names: true
dir_names_deleted_files_include_only_deleted_dirs: true
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs) }}'
shell:
bash
- name: Check deleted_files output on non windows platform
if: steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files != 'test/test3' && runner.os != 'Windows'
run: |
echo "Invalid output: Expected (test/test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files }})"
exit 1
shell:
bash
- name: Check deleted_files output on windows platform
if: "!contains(steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files, 'test\\test3') && runner.os == 'Windows'"
run: |
echo "Invalid output: Expected (test\\test3) got (${{ steps.changed-files-dir-names-deleted-files-include-only-deleted-dirs-directory.outputs.deleted_files }})"
exit 1
shell:
bash
test-since-last-remote-commit: test-since-last-remote-commit:
name: Test changed-files since last remote commit name: Test changed-files since last remote commit
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -1423,14 +1497,14 @@ jobs:
fi fi
shell: shell:
bash bash
- name: Check if a excluded file is not included in any_deleted on non windows platform - name: Check if an excluded file is included in deleted_files output on non windows platform
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'" if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test/test/test.txt') && runner.os != 'Windows'"
run: | run: |
echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})" echo "Invalid output: Expected not to include (test/test/test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"
exit 1 exit 1
shell: shell:
bash bash
- name: Check if a excluded file is not included in any_deleted on windows platform - name: Check if an excluded file is included in deleted_files output on windows platform
if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test\\test.txt') && runner.os == 'Windows'" if: "contains(steps.changed-files-specific.outputs.deleted_files, 'test\\test\\test.txt') && runner.os == 'Windows'"
run: | run: |
echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})" echo "Invalid output: Expected not to include (test\\test\\test.txt) got (${{ steps.changed-files-specific.outputs.deleted_files }})"

View File

@ -120,6 +120,10 @@ inputs:
description: "Separator used to split the `dir_names_include_files` input" description: "Separator used to split the `dir_names_include_files` input"
default: "\n" default: "\n"
required: false required: false
dir_names_deleted_files_include_only_deleted_dirs:
description: "Include only directories that have been deleted as opposed to directory names of files that have been deleted in the `deleted_files` output when `dir_names` is set to `true`."
required: false
default: "false"
json: json:
description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml)" description: "Output list of changed files in a JSON formatted string which can be used for matrix jobs. [Example](https://github.com/tj-actions/changed-files/blob/main/.github/workflows/matrix-test.yml)"
required: false required: false

51
dist/index.js generated vendored
View File

@ -57,7 +57,7 @@ const micromatch_1 = __importDefault(__nccwpck_require__(6228));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
const changedFilesOutput_1 = __nccwpck_require__(8930); const changedFilesOutput_1 = __nccwpck_require__(8930);
const utils_1 = __nccwpck_require__(918); const utils_1 = __nccwpck_require__(918);
const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns }) => __awaiter(void 0, void 0, void 0, function* () { const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatterns, workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
if (filePatterns.length > 0) { if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns'); core.startGroup('changed-files-patterns');
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({ const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
@ -69,7 +69,8 @@ const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatte
allDiffFiles, allDiffFiles,
allFilteredDiffFiles, allFilteredDiffFiles,
inputs, inputs,
filePatterns filePatterns,
workingDirectory
}); });
core.info('All Done!'); core.info('All Done!');
core.endGroup(); core.endGroup();
@ -89,7 +90,8 @@ const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatte
allFilteredDiffFiles, allFilteredDiffFiles,
inputs, inputs,
filePatterns: yamlFilePatterns[key], filePatterns: yamlFilePatterns[key],
outputPrefix: key outputPrefix: key,
workingDirectory
}); });
if (anyModified) { if (anyModified) {
modifiedKeys.push(key); modifiedKeys.push(key);
@ -120,7 +122,8 @@ const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatte
yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({ yield (0, changedFilesOutput_1.setOutputsAndGetModifiedAndChangedFilesStatus)({
allDiffFiles, allDiffFiles,
allFilteredDiffFiles: allDiffFiles, allFilteredDiffFiles: allDiffFiles,
inputs inputs,
workingDirectory
}); });
core.info('All Done!'); core.info('All Done!');
core.endGroup(); core.endGroup();
@ -426,15 +429,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.setOutputsAndGetModifiedAndChangedFilesStatus = void 0; exports.setOutputsAndGetModifiedAndChangedFilesStatus = void 0;
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path_1 = __importDefault(__nccwpck_require__(1017));
const changedFiles_1 = __nccwpck_require__(7358); const changedFiles_1 = __nccwpck_require__(7358);
const utils_1 = __nccwpck_require__(918); const utils_1 = __nccwpck_require__(918);
const getArrayFromPaths = (paths, inputs) => { const getArrayFromPaths = (paths, inputs) => {
return Array.isArray(paths) ? paths : paths.split(inputs.separator); return Array.isArray(paths) ? paths : paths.split(inputs.separator);
}; };
const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '' }) => __awaiter(void 0, void 0, void 0, function* () { const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilteredDiffFiles, inputs, filePatterns = [], outputPrefix = '', workingDirectory }) => __awaiter(void 0, void 0, void 0, function* () {
const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({ const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
inputs, inputs,
changedFiles: allFilteredDiffFiles, changedFiles: allFilteredDiffFiles,
@ -737,6 +744,24 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted] changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted]
}); });
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`); core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`);
if (inputs.dirNamesDeletedFilesIncludeOnlyDeletedDirs &&
inputs.dirNames &&
workingDirectory) {
const newDeletedFilesPaths = [];
for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) {
const dirPath = path_1.default.join(workingDirectory, deletedPath);
core.debug(`Checking if directory exists: ${dirPath}`);
if (!(yield (0, utils_1.exists)(dirPath))) {
core.debug(`Directory not found: ${dirPath}`);
newDeletedFilesPaths.push(deletedPath);
}
}
deletedFiles.paths = inputs.json
? newDeletedFilesPaths
: newDeletedFilesPaths.join(inputs.separator);
deletedFiles.count = newDeletedFilesPaths.length.toString();
core.debug(`New deleted files: ${JSON.stringify(deletedFiles)}`);
}
yield (0, utils_1.setOutput)({ yield (0, utils_1.setOutput)({
key: (0, utils_1.getOutputKey)('deleted_files', outputPrefix), key: (0, utils_1.getOutputKey)('deleted_files', outputPrefix),
value: deletedFiles.paths, value: deletedFiles.paths,
@ -1493,6 +1518,9 @@ const getInputs = () => {
const failOnSubmoduleDiffError = core.getBooleanInput('fail_on_submodule_diff_error', { const failOnSubmoduleDiffError = core.getBooleanInput('fail_on_submodule_diff_error', {
required: false required: false
}); });
const dirNamesDeletedFilesIncludeOnlyDeletedDirs = core.getBooleanInput('dir_names_deleted_files_include_only_deleted_dirs', {
required: false
});
const inputs = { const inputs = {
files, files,
filesSeparator, filesSeparator,
@ -1536,6 +1564,7 @@ const getInputs = () => {
dirNamesExcludeCurrentDir, dirNamesExcludeCurrentDir,
dirNamesIncludeFiles, dirNamesIncludeFiles,
dirNamesIncludeFilesSeparator, dirNamesIncludeFilesSeparator,
dirNamesDeletedFilesIncludeOnlyDeletedDirs,
json, json,
escapeJson, escapeJson,
writeOutputFiles, writeOutputFiles,
@ -1682,7 +1711,8 @@ const getChangedFilesFromLocalGitHistory = ({ inputs, env, workingDirectory, fil
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
yamlFilePatterns yamlFilePatterns,
workingDirectory
}); });
if (inputs.includeAllOldNewRenamedFiles) { if (inputs.includeAllOldNewRenamedFiles) {
core.startGroup('changed-files-all-old-new-renamed-files'); core.startGroup('changed-files-all-old-new-renamed-files');
@ -1865,7 +1895,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.setArrayOutput = exports.getOutputKey = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0; exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = exports.setArrayOutput = exports.getOutputKey = exports.getRecoverFilePatterns = exports.getYamlFilePatterns = exports.getFilePatterns = exports.getDirNamesIncludeFilesPattern = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.isInsideWorkTree = exports.getHeadSha = exports.gitLog = exports.getFilteredChangedFiles = exports.getAllChangedFiles = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.exists = exports.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
/*global AsyncIterableIterator*/ /*global AsyncIterableIterator*/
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const exec = __importStar(__nccwpck_require__(1514)); const exec = __importStar(__nccwpck_require__(1514));
@ -1991,6 +2021,7 @@ const exists = (filePath) => __awaiter(void 0, void 0, void 0, function* () {
return false; return false;
} }
}); });
exports.exists = exists;
/** /**
* Generates lines of a file as an async iterable iterator * Generates lines of a file as an async iterable iterator
* @param filePath - path of file to read * @param filePath - path of file to read
@ -2562,7 +2593,7 @@ const getYamlFilePatternsFromContents = ({ content = '', filePath = '', excluded
const filePatterns = {}; const filePatterns = {};
let source = ''; let source = '';
if (filePath) { if (filePath) {
if (!(yield exists(filePath))) { if (!(yield (0, exports.exists)(filePath))) {
core.error(`File does not exist: ${filePath}`); core.error(`File does not exist: ${filePath}`);
throw new Error(`File does not exist: ${filePath}`); throw new Error(`File does not exist: ${filePath}`);
} }
@ -2714,7 +2745,7 @@ const setOutput = ({ key, value, writeOutputFiles, outputDir, json = false, shou
if (writeOutputFiles) { if (writeOutputFiles) {
const extension = json ? 'json' : 'txt'; const extension = json ? 'json' : 'txt';
const outputFilePath = path.join(outputDir, `${key}.${extension}`); const outputFilePath = path.join(outputDir, `${key}.${extension}`);
if (!(yield exists(outputDir))) { if (!(yield (0, exports.exists)(outputDir))) {
yield fs_1.promises.mkdir(outputDir, { recursive: true }); yield fs_1.promises.mkdir(outputDir, { recursive: true });
} }
yield fs_1.promises.writeFile(outputFilePath, cleanedValue.replace(/\\"/g, '"')); yield fs_1.promises.writeFile(outputFilePath, cleanedValue.replace(/\\"/g, '"'));
@ -2753,7 +2784,7 @@ const recoverDeletedFiles = ({ inputs, workingDirectory, deletedFiles, recoverPa
filePath: deletedFile, filePath: deletedFile,
sha sha
}); });
if (!(yield exists(path.dirname(target)))) { if (!(yield (0, exports.exists)(path.dirname(target)))) {
yield fs_1.promises.mkdir(path.dirname(target), { recursive: true }); yield fs_1.promises.mkdir(path.dirname(target), { recursive: true });
} }
yield fs_1.promises.writeFile(target, deletedFileContents); yield fs_1.promises.writeFile(target, deletedFileContents);

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -24,12 +24,14 @@ export const processChangedFiles = async ({
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
yamlFilePatterns yamlFilePatterns,
workingDirectory
}: { }: {
filePatterns: string[] filePatterns: string[]
allDiffFiles: ChangedFiles allDiffFiles: ChangedFiles
inputs: Inputs inputs: Inputs
yamlFilePatterns: Record<string, string[]> yamlFilePatterns: Record<string, string[]>
workingDirectory?: string
}): Promise<void> => { }): Promise<void> => {
if (filePatterns.length > 0) { if (filePatterns.length > 0) {
core.startGroup('changed-files-patterns') core.startGroup('changed-files-patterns')
@ -44,7 +46,8 @@ export const processChangedFiles = async ({
allDiffFiles, allDiffFiles,
allFilteredDiffFiles, allFilteredDiffFiles,
inputs, inputs,
filePatterns filePatterns,
workingDirectory
}) })
core.info('All Done!') core.info('All Done!')
core.endGroup() core.endGroup()
@ -71,7 +74,8 @@ export const processChangedFiles = async ({
allFilteredDiffFiles, allFilteredDiffFiles,
inputs, inputs,
filePatterns: yamlFilePatterns[key], filePatterns: yamlFilePatterns[key],
outputPrefix: key outputPrefix: key,
workingDirectory
}) })
if (anyModified) { if (anyModified) {
modifiedKeys.push(key) modifiedKeys.push(key)
@ -106,7 +110,8 @@ export const processChangedFiles = async ({
await setOutputsAndGetModifiedAndChangedFilesStatus({ await setOutputsAndGetModifiedAndChangedFilesStatus({
allDiffFiles, allDiffFiles,
allFilteredDiffFiles: allDiffFiles, allFilteredDiffFiles: allDiffFiles,
inputs inputs,
workingDirectory
}) })
core.info('All Done!') core.info('All Done!')
core.endGroup() core.endGroup()

View File

@ -1,4 +1,5 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import path from 'path'
import { import {
ChangedFiles, ChangedFiles,
ChangeTypeEnum, ChangeTypeEnum,
@ -6,7 +7,7 @@ import {
getChangeTypeFiles getChangeTypeFiles
} from './changedFiles' } from './changedFiles'
import {Inputs} from './inputs' import {Inputs} from './inputs'
import {getOutputKey, setArrayOutput, setOutput} from './utils' import {getOutputKey, setArrayOutput, setOutput, exists} from './utils'
const getArrayFromPaths = ( const getArrayFromPaths = (
paths: string | string[], paths: string | string[],
@ -20,13 +21,15 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
allFilteredDiffFiles, allFilteredDiffFiles,
inputs, inputs,
filePatterns = [], filePatterns = [],
outputPrefix = '' outputPrefix = '',
workingDirectory
}: { }: {
allDiffFiles: ChangedFiles allDiffFiles: ChangedFiles
allFilteredDiffFiles: ChangedFiles allFilteredDiffFiles: ChangedFiles
inputs: Inputs inputs: Inputs
filePatterns?: string[] filePatterns?: string[]
outputPrefix?: string outputPrefix?: string
workingDirectory?: string
}): Promise<{anyModified: boolean; anyChanged: boolean}> => { }): Promise<{anyModified: boolean; anyChanged: boolean}> => {
const addedFiles = await getChangeTypeFiles({ const addedFiles = await getChangeTypeFiles({
inputs, inputs,
@ -388,6 +391,28 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
changeTypes: [ChangeTypeEnum.Deleted] changeTypes: [ChangeTypeEnum.Deleted]
}) })
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`) core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`)
if (
inputs.dirNamesDeletedFilesIncludeOnlyDeletedDirs &&
inputs.dirNames &&
workingDirectory
) {
const newDeletedFilesPaths: string[] = []
for (const deletedPath of getArrayFromPaths(deletedFiles.paths, inputs)) {
const dirPath = path.join(workingDirectory, deletedPath)
core.debug(`Checking if directory exists: ${dirPath}`)
if (!(await exists(dirPath))) {
core.debug(`Directory not found: ${dirPath}`)
newDeletedFilesPaths.push(deletedPath)
}
}
deletedFiles.paths = inputs.json
? newDeletedFilesPaths
: newDeletedFilesPaths.join(inputs.separator)
deletedFiles.count = newDeletedFilesPaths.length.toString()
core.debug(`New deleted files: ${JSON.stringify(deletedFiles)}`)
}
await setOutput({ await setOutput({
key: getOutputKey('deleted_files', outputPrefix), key: getOutputKey('deleted_files', outputPrefix),
value: deletedFiles.paths, value: deletedFiles.paths,

View File

@ -31,6 +31,7 @@ export type Inputs = {
dirNamesExcludeCurrentDir: boolean dirNamesExcludeCurrentDir: boolean
dirNamesIncludeFiles: string dirNamesIncludeFiles: string
dirNamesIncludeFilesSeparator: string dirNamesIncludeFilesSeparator: string
dirNamesDeletedFilesIncludeOnlyDeletedDirs: boolean
json: boolean json: boolean
escapeJson: boolean escapeJson: boolean
fetchDepth?: number fetchDepth?: number
@ -210,6 +211,12 @@ export const getInputs = (): Inputs => {
required: false required: false
} }
) )
const dirNamesDeletedFilesIncludeOnlyDeletedDirs = core.getBooleanInput(
'dir_names_deleted_files_include_only_deleted_dirs',
{
required: false
}
)
const inputs: Inputs = { const inputs: Inputs = {
files, files,
@ -254,6 +261,7 @@ export const getInputs = (): Inputs => {
dirNamesExcludeCurrentDir, dirNamesExcludeCurrentDir,
dirNamesIncludeFiles, dirNamesIncludeFiles,
dirNamesIncludeFilesSeparator, dirNamesIncludeFilesSeparator,
dirNamesDeletedFilesIncludeOnlyDeletedDirs,
json, json,
escapeJson, escapeJson,
writeOutputFiles, writeOutputFiles,

View File

@ -152,7 +152,8 @@ const getChangedFilesFromLocalGitHistory = async ({
filePatterns, filePatterns,
allDiffFiles, allDiffFiles,
inputs, inputs,
yamlFilePatterns yamlFilePatterns,
workingDirectory
}) })
if (inputs.includeAllOldNewRenamedFiles) { if (inputs.includeAllOldNewRenamedFiles) {

View File

@ -139,7 +139,7 @@ export const verifyMinimumGitVersion = async (): Promise<void> => {
* @param filePath - path to check * @param filePath - path to check
* @returns path exists * @returns path exists
*/ */
const exists = async (filePath: string): Promise<boolean> => { export const exists = async (filePath: string): Promise<boolean> => {
try { try {
await fs.access(filePath) await fs.access(filePath)
return true return true