mirror of
https://github.com/tj-actions/changed-files
synced 2025-03-05 11:06:22 +00:00
feat: switch to use name status (#1230)
Co-authored-by: tj-actions[bot] <109116665+tj-actions-bot@users.noreply.github.com> Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
2d0b52f440
commit
174a2a6360
11 changed files with 1448 additions and 840 deletions
|
@ -60,6 +60,8 @@
|
|||
"@typescript-eslint/promise-function-async": "error",
|
||||
"@typescript-eslint/require-array-sort-compare": "error",
|
||||
"@typescript-eslint/restrict-plus-operands": "error",
|
||||
"no-shadow": "off",
|
||||
"@typescript-eslint/no-shadow": "error",
|
||||
"semi": "off",
|
||||
"filenames/match-regex": [
|
||||
"error",
|
||||
|
|
770
dist/index.js
generated
vendored
770
dist/index.js
generated
vendored
|
@ -38,10 +38,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|||
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 }));
|
||||
exports.getDiffFiles = exports.getRenamedFiles = void 0;
|
||||
exports.getAllChangeTypeFiles = exports.getChangeTypeFiles = exports.getAllDiffFiles = exports.ChangeTypeEnum = exports.getRenamedFiles = void 0;
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const utils_1 = __nccwpck_require__(918);
|
||||
const flatten_1 = __importDefault(__nccwpck_require__(2394));
|
||||
const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const renamedFiles = yield (0, utils_1.gitRenamedFiles)({
|
||||
cwd: workingDirectory,
|
||||
|
@ -80,14 +84,23 @@ const getRenamedFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, s
|
|||
return renamedFiles.join(inputs.oldNewFilesSeparator);
|
||||
});
|
||||
exports.getRenamedFiles = getRenamedFiles;
|
||||
const getDiffFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, diffFilter, filePatterns = [], submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
let files = yield (0, utils_1.gitDiff)({
|
||||
var ChangeTypeEnum;
|
||||
(function (ChangeTypeEnum) {
|
||||
ChangeTypeEnum["Added"] = "A";
|
||||
ChangeTypeEnum["Copied"] = "C";
|
||||
ChangeTypeEnum["Deleted"] = "D";
|
||||
ChangeTypeEnum["Modified"] = "M";
|
||||
ChangeTypeEnum["Renamed"] = "R";
|
||||
ChangeTypeEnum["TypeChanged"] = "T";
|
||||
ChangeTypeEnum["Unmerged"] = "U";
|
||||
ChangeTypeEnum["Unknown"] = "X";
|
||||
})(ChangeTypeEnum || (exports.ChangeTypeEnum = ChangeTypeEnum = {}));
|
||||
const getAllDiffFiles = ({ workingDirectory, hasSubmodule, diffResult, submodulePaths }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const files = yield (0, utils_1.getAllChangedFiles)({
|
||||
cwd: workingDirectory,
|
||||
sha1: diffResult.previousSha,
|
||||
sha2: diffResult.currentSha,
|
||||
diff: diffResult.diff,
|
||||
diffFilter,
|
||||
filePatterns
|
||||
diff: diffResult.diff
|
||||
});
|
||||
if (hasSubmodule) {
|
||||
for (const submodulePath of submodulePaths) {
|
||||
|
@ -100,34 +113,77 @@ const getDiffFiles = ({ inputs, workingDirectory, hasSubmodule, diffResult, diff
|
|||
});
|
||||
const submoduleWorkingDirectory = path.join(workingDirectory, submodulePath);
|
||||
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
||||
const submoduleFiles = yield (0, utils_1.gitDiff)({
|
||||
const submoduleFiles = yield (0, utils_1.getAllChangedFiles)({
|
||||
cwd: submoduleWorkingDirectory,
|
||||
sha1: submoduleShaResult.previousSha,
|
||||
sha2: submoduleShaResult.currentSha,
|
||||
diff: diffResult.diff,
|
||||
diffFilter,
|
||||
isSubmodule: true,
|
||||
filePatterns,
|
||||
parentDir: submodulePath
|
||||
});
|
||||
files.push(...submoduleFiles);
|
||||
for (const changeType of Object.keys(submoduleFiles)) {
|
||||
if (!files[changeType]) {
|
||||
files[changeType] = [];
|
||||
}
|
||||
files[changeType].push(...submoduleFiles[changeType]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (inputs.dirNames) {
|
||||
files = files.map(file => (0, utils_1.getDirnameMaxDepth)({
|
||||
pathStr: file,
|
||||
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
|
||||
excludeCurrentDir: inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
|
||||
}));
|
||||
files = [...new Set(files)];
|
||||
return files;
|
||||
});
|
||||
exports.getAllDiffFiles = getAllDiffFiles;
|
||||
function* getChangeTypeFilesGenerator({ inputs, changedFiles, changeTypes }) {
|
||||
for (const changeType of changeTypes) {
|
||||
const files = changedFiles[changeType] || [];
|
||||
for (const file of files) {
|
||||
if (inputs.dirNames) {
|
||||
yield (0, utils_1.getDirnameMaxDepth)({
|
||||
pathStr: file,
|
||||
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
|
||||
excludeCurrentDir: inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
|
||||
});
|
||||
}
|
||||
else {
|
||||
yield file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
const getChangeTypeFiles = ({ inputs, changedFiles, changeTypes }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const files = [
|
||||
...new Set(getChangeTypeFilesGenerator({ inputs, changedFiles, changeTypes }))
|
||||
];
|
||||
if (inputs.json) {
|
||||
return (0, utils_1.jsonOutput)({ value: files, shouldEscape: inputs.escapeJson });
|
||||
}
|
||||
return files.join(inputs.separator);
|
||||
});
|
||||
exports.getDiffFiles = getDiffFiles;
|
||||
exports.getChangeTypeFiles = getChangeTypeFiles;
|
||||
function* getAllChangeTypeFilesGenerator({ inputs, changedFiles }) {
|
||||
for (const file of (0, flatten_1.default)(Object.values(changedFiles))) {
|
||||
if (inputs.dirNames) {
|
||||
yield (0, utils_1.getDirnameMaxDepth)({
|
||||
pathStr: file,
|
||||
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
|
||||
excludeCurrentDir: inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
|
||||
});
|
||||
}
|
||||
else {
|
||||
yield file;
|
||||
}
|
||||
}
|
||||
}
|
||||
const getAllChangeTypeFiles = ({ inputs, changedFiles }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const files = [
|
||||
...new Set(getAllChangeTypeFilesGenerator({ inputs, changedFiles }))
|
||||
];
|
||||
if (inputs.json) {
|
||||
return (0, utils_1.jsonOutput)({ value: files, shouldEscape: inputs.escapeJson });
|
||||
}
|
||||
return files.join(inputs.separator);
|
||||
});
|
||||
exports.getAllChangeTypeFiles = getAllChangeTypeFiles;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
@ -444,8 +500,17 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
|||
}
|
||||
if (!previousSha) {
|
||||
if (inputs.sinceLastRemoteCommit) {
|
||||
previousSha = env.GITHUB_EVENT_BEFORE;
|
||||
if ((yield (0, utils_1.verifyCommitSha)({ sha: previousSha, cwd: workingDirectory })) !== 0) {
|
||||
previousSha =
|
||||
env.GITHUB_EVENT_BEFORE ||
|
||||
(yield (0, utils_1.getRemoteBranchHeadSha)({
|
||||
cwd: workingDirectory,
|
||||
branch: currentBranch
|
||||
}));
|
||||
if (!previousSha ||
|
||||
(previousSha &&
|
||||
(yield (0, utils_1.verifyCommitSha)({ sha: previousSha, cwd: workingDirectory })) !==
|
||||
0)) {
|
||||
core.warning('Unable to locate the remote branch head sha. Falling back to the pull request base sha.');
|
||||
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA;
|
||||
}
|
||||
}
|
||||
|
@ -856,29 +921,34 @@ function run() {
|
|||
inputs,
|
||||
workingDirectory
|
||||
});
|
||||
const addedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
inputs,
|
||||
core.debug(`File patterns: ${filePatterns}`);
|
||||
const allDiffFiles = yield (0, changedFiles_1.getAllDiffFiles)({
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'A',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
});
|
||||
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`);
|
||||
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
|
||||
allDiffFiles,
|
||||
filePatterns
|
||||
});
|
||||
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`);
|
||||
const addedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Added]
|
||||
});
|
||||
core.debug(`Added files: ${addedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: 'added_files',
|
||||
value: addedFiles,
|
||||
inputs
|
||||
});
|
||||
const copiedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const copiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'C',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Copied]
|
||||
});
|
||||
core.debug(`Copied files: ${copiedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -886,14 +956,10 @@ function run() {
|
|||
value: copiedFiles,
|
||||
inputs
|
||||
});
|
||||
const modifiedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const modifiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'M',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Modified]
|
||||
});
|
||||
core.debug(`Modified files: ${modifiedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -901,14 +967,10 @@ function run() {
|
|||
value: modifiedFiles,
|
||||
inputs
|
||||
});
|
||||
const renamedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const renamedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'R',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Renamed]
|
||||
});
|
||||
core.debug(`Renamed files: ${renamedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -916,14 +978,10 @@ function run() {
|
|||
value: renamedFiles,
|
||||
inputs
|
||||
});
|
||||
const typeChangedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const typeChangedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'T',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.TypeChanged]
|
||||
});
|
||||
core.debug(`Type changed files: ${typeChangedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -931,14 +989,10 @@ function run() {
|
|||
value: typeChangedFiles,
|
||||
inputs
|
||||
});
|
||||
const unmergedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const unmergedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'U',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Unmerged]
|
||||
});
|
||||
core.debug(`Unmerged files: ${unmergedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -946,14 +1000,10 @@ function run() {
|
|||
value: unmergedFiles,
|
||||
inputs
|
||||
});
|
||||
const unknownFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const unknownFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'X',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Unknown]
|
||||
});
|
||||
core.debug(`Unknown files: ${unknownFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -961,14 +1011,9 @@ function run() {
|
|||
value: unknownFiles,
|
||||
inputs
|
||||
});
|
||||
const allChangedAndModifiedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const allChangedAndModifiedFiles = yield (0, changedFiles_1.getAllChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACDMRTUX',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles
|
||||
});
|
||||
core.debug(`All changed and modified files: ${allChangedAndModifiedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -976,14 +1021,15 @@ function run() {
|
|||
value: allChangedAndModifiedFiles,
|
||||
inputs
|
||||
});
|
||||
const allChangedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const allChangedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMR',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [
|
||||
changedFiles_1.ChangeTypeEnum.Added,
|
||||
changedFiles_1.ChangeTypeEnum.Copied,
|
||||
changedFiles_1.ChangeTypeEnum.Modified,
|
||||
changedFiles_1.ChangeTypeEnum.Renamed
|
||||
]
|
||||
});
|
||||
core.debug(`All changed files: ${allChangedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -996,13 +1042,15 @@ function run() {
|
|||
value: allChangedFiles.length > 0 && filePatterns.length > 0,
|
||||
inputs
|
||||
});
|
||||
const allOtherChangedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const allOtherChangedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMR',
|
||||
submodulePaths
|
||||
changedFiles: allDiffFiles,
|
||||
changeTypes: [
|
||||
changedFiles_1.ChangeTypeEnum.Added,
|
||||
changedFiles_1.ChangeTypeEnum.Copied,
|
||||
changedFiles_1.ChangeTypeEnum.Modified,
|
||||
changedFiles_1.ChangeTypeEnum.Renamed
|
||||
]
|
||||
});
|
||||
core.debug(`All other changed files: ${allOtherChangedFiles}`);
|
||||
const otherChangedFiles = allOtherChangedFiles
|
||||
|
@ -1021,14 +1069,16 @@ function run() {
|
|||
value: otherChangedFiles.join(inputs.separator),
|
||||
inputs
|
||||
});
|
||||
const allModifiedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const allModifiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMRD',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [
|
||||
changedFiles_1.ChangeTypeEnum.Added,
|
||||
changedFiles_1.ChangeTypeEnum.Copied,
|
||||
changedFiles_1.ChangeTypeEnum.Modified,
|
||||
changedFiles_1.ChangeTypeEnum.Renamed,
|
||||
changedFiles_1.ChangeTypeEnum.Deleted
|
||||
]
|
||||
});
|
||||
core.debug(`All modified files: ${allModifiedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -1041,13 +1091,16 @@ function run() {
|
|||
value: allModifiedFiles.length > 0 && filePatterns.length > 0,
|
||||
inputs
|
||||
});
|
||||
const allOtherModifiedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const allOtherModifiedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMRD',
|
||||
submodulePaths
|
||||
changedFiles: allDiffFiles,
|
||||
changeTypes: [
|
||||
changedFiles_1.ChangeTypeEnum.Added,
|
||||
changedFiles_1.ChangeTypeEnum.Copied,
|
||||
changedFiles_1.ChangeTypeEnum.Modified,
|
||||
changedFiles_1.ChangeTypeEnum.Renamed,
|
||||
changedFiles_1.ChangeTypeEnum.Deleted
|
||||
]
|
||||
});
|
||||
const otherModifiedFiles = allOtherModifiedFiles
|
||||
.split(inputs.separator)
|
||||
|
@ -1065,14 +1118,10 @@ function run() {
|
|||
value: otherModifiedFiles.join(inputs.separator),
|
||||
inputs
|
||||
});
|
||||
const deletedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const deletedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'D',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted]
|
||||
});
|
||||
core.debug(`Deleted files: ${deletedFiles}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
|
@ -1085,13 +1134,10 @@ function run() {
|
|||
value: deletedFiles.length > 0 && filePatterns.length > 0,
|
||||
inputs
|
||||
});
|
||||
const allOtherDeletedFiles = yield (0, changedFiles_1.getDiffFiles)({
|
||||
const allOtherDeletedFiles = yield (0, changedFiles_1.getChangeTypeFiles)({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'D',
|
||||
submodulePaths
|
||||
changedFiles: allDiffFiles,
|
||||
changeTypes: [changedFiles_1.ChangeTypeEnum.Deleted]
|
||||
});
|
||||
const otherDeletedFiles = allOtherDeletedFiles
|
||||
.split(inputs.separator)
|
||||
|
@ -1200,7 +1246,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.setOutput = exports.getFilePatterns = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = exports.getHeadSha = exports.gitLog = exports.gitDiff = exports.gitRenamedFiles = exports.gitSubmoduleDiffSHA = exports.getSubmodulePath = exports.gitFetchSubmodules = exports.gitFetch = exports.submoduleExists = exports.isRepoShallow = exports.updateGitGlobalConfig = exports.verifyMinimumGitVersion = void 0;
|
||||
exports.setOutput = exports.getFilePatterns = exports.jsonOutput = exports.getDirnameMaxDepth = exports.canDiffCommits = exports.getPreviousGitTag = exports.verifyCommitSha = exports.getParentSha = exports.getRemoteBranchHeadSha = 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 = void 0;
|
||||
/*global AsyncIterableIterator*/
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
|
@ -1208,6 +1254,7 @@ const fs_1 = __nccwpck_require__(7147);
|
|||
const micromatch_1 = __importDefault(__nccwpck_require__(6228));
|
||||
const path = __importStar(__nccwpck_require__(1017));
|
||||
const readline_1 = __nccwpck_require__(4521);
|
||||
const changedFiles_1 = __nccwpck_require__(7358);
|
||||
const IS_WINDOWS = process.platform === 'win32';
|
||||
const MINIMUM_GIT_VERSION = '2.18.0';
|
||||
/**
|
||||
|
@ -1483,18 +1530,28 @@ const gitRenamedFiles = ({ cwd, sha1, sha2, diff, oldNewSeparator, isSubmodule =
|
|||
});
|
||||
});
|
||||
exports.gitRenamedFiles = gitRenamedFiles;
|
||||
const gitDiff = ({ cwd, sha1, sha2, diff, diffFilter, filePatterns = [], isSubmodule = false, parentDir = '' }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const getAllChangedFiles = ({ cwd, sha1, sha2, diff, isSubmodule = false, parentDir = '' }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { exitCode, stdout, stderr } = yield exec.getExecOutput('git', [
|
||||
'diff',
|
||||
'--name-only',
|
||||
'--name-status',
|
||||
'--ignore-submodules=all',
|
||||
`--diff-filter=${diffFilter}`,
|
||||
`--diff-filter=ACDMRTUX`,
|
||||
`${sha1}${diff}${sha2}`
|
||||
], {
|
||||
cwd,
|
||||
ignoreReturnCode: true,
|
||||
silent: process.env.RUNNER_DEBUG !== '1'
|
||||
});
|
||||
const changedFiles = {
|
||||
[changedFiles_1.ChangeTypeEnum.Added]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Copied]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Deleted]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Modified]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Renamed]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.TypeChanged]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Unmerged]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Unknown]: []
|
||||
};
|
||||
if (exitCode !== 0) {
|
||||
if (isSubmodule) {
|
||||
core.warning(stderr ||
|
||||
|
@ -1504,27 +1561,52 @@ const gitDiff = ({ cwd, sha1, sha2, diff, diffFilter, filePatterns = [], isSubmo
|
|||
else {
|
||||
core.warning(stderr || `Failed to get changed files between: ${sha1}${diff}${sha2}`);
|
||||
}
|
||||
return [];
|
||||
return changedFiles;
|
||||
}
|
||||
const files = stdout
|
||||
.split('\n')
|
||||
.filter(Boolean)
|
||||
.map((p) => {
|
||||
if (isSubmodule) {
|
||||
return normalizePath(path.join(parentDir, p));
|
||||
const lines = stdout.split('\n').filter(Boolean);
|
||||
for (const line of lines) {
|
||||
const [changeType, filePath] = line.split('\t');
|
||||
const normalizedFilePath = isSubmodule
|
||||
? normalizePath(path.join(parentDir, filePath))
|
||||
: normalizePath(filePath);
|
||||
if (changeType.startsWith('R')) {
|
||||
changedFiles[changedFiles_1.ChangeTypeEnum.Renamed].push(normalizedFilePath);
|
||||
}
|
||||
else {
|
||||
changedFiles[changeType].push(normalizedFilePath);
|
||||
}
|
||||
return normalizePath(p);
|
||||
});
|
||||
if (filePatterns.length === 0) {
|
||||
return files;
|
||||
}
|
||||
return (0, micromatch_1.default)(files, filePatterns, {
|
||||
dot: true,
|
||||
windows: IS_WINDOWS,
|
||||
noext: true
|
||||
});
|
||||
return changedFiles;
|
||||
});
|
||||
exports.gitDiff = gitDiff;
|
||||
exports.getAllChangedFiles = getAllChangedFiles;
|
||||
const getFilteredChangedFiles = ({ allDiffFiles, filePatterns }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const changedFiles = {
|
||||
[changedFiles_1.ChangeTypeEnum.Added]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Copied]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Deleted]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Modified]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Renamed]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.TypeChanged]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Unmerged]: [],
|
||||
[changedFiles_1.ChangeTypeEnum.Unknown]: []
|
||||
};
|
||||
for (const changeType of Object.keys(allDiffFiles)) {
|
||||
const files = allDiffFiles[changeType];
|
||||
const hasFilePatterns = filePatterns.length > 0;
|
||||
if (hasFilePatterns) {
|
||||
changedFiles[changeType] = (0, micromatch_1.default)(files, filePatterns, {
|
||||
dot: true,
|
||||
windows: IS_WINDOWS,
|
||||
noext: true
|
||||
});
|
||||
}
|
||||
else {
|
||||
changedFiles[changeType] = files;
|
||||
}
|
||||
}
|
||||
return changedFiles;
|
||||
});
|
||||
exports.getFilteredChangedFiles = getFilteredChangedFiles;
|
||||
const gitLog = ({ args, cwd }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
const { stdout } = yield exec.getExecOutput('git', ['log', ...args], {
|
||||
cwd,
|
||||
|
@ -5935,6 +6017,428 @@ module.exports = function(num) {
|
|||
};
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9213:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var root = __nccwpck_require__(9882);
|
||||
|
||||
/** Built-in value references. */
|
||||
var Symbol = root.Symbol;
|
||||
|
||||
module.exports = Symbol;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 82:
|
||||
/***/ ((module) => {
|
||||
|
||||
/**
|
||||
* Appends the elements of `values` to `array`.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to modify.
|
||||
* @param {Array} values The values to append.
|
||||
* @returns {Array} Returns `array`.
|
||||
*/
|
||||
function arrayPush(array, values) {
|
||||
var index = -1,
|
||||
length = values.length,
|
||||
offset = array.length;
|
||||
|
||||
while (++index < length) {
|
||||
array[offset + index] = values[index];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
module.exports = arrayPush;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9588:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var arrayPush = __nccwpck_require__(82),
|
||||
isFlattenable = __nccwpck_require__(9299);
|
||||
|
||||
/**
|
||||
* The base implementation of `_.flatten` with support for restricting flattening.
|
||||
*
|
||||
* @private
|
||||
* @param {Array} array The array to flatten.
|
||||
* @param {number} depth The maximum recursion depth.
|
||||
* @param {boolean} [predicate=isFlattenable] The function invoked per iteration.
|
||||
* @param {boolean} [isStrict] Restrict to values that pass `predicate` checks.
|
||||
* @param {Array} [result=[]] The initial result value.
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
*/
|
||||
function baseFlatten(array, depth, predicate, isStrict, result) {
|
||||
var index = -1,
|
||||
length = array.length;
|
||||
|
||||
predicate || (predicate = isFlattenable);
|
||||
result || (result = []);
|
||||
|
||||
while (++index < length) {
|
||||
var value = array[index];
|
||||
if (depth > 0 && predicate(value)) {
|
||||
if (depth > 1) {
|
||||
// Recursively flatten arrays (susceptible to call stack limits).
|
||||
baseFlatten(value, depth - 1, predicate, isStrict, result);
|
||||
} else {
|
||||
arrayPush(result, value);
|
||||
}
|
||||
} else if (!isStrict) {
|
||||
result[result.length] = value;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = baseFlatten;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 7497:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var Symbol = __nccwpck_require__(9213),
|
||||
getRawTag = __nccwpck_require__(923),
|
||||
objectToString = __nccwpck_require__(4200);
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var nullTag = '[object Null]',
|
||||
undefinedTag = '[object Undefined]';
|
||||
|
||||
/** Built-in value references. */
|
||||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||||
|
||||
/**
|
||||
* The base implementation of `getTag` without fallbacks for buggy environments.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @returns {string} Returns the `toStringTag`.
|
||||
*/
|
||||
function baseGetTag(value) {
|
||||
if (value == null) {
|
||||
return value === undefined ? undefinedTag : nullTag;
|
||||
}
|
||||
return (symToStringTag && symToStringTag in Object(value))
|
||||
? getRawTag(value)
|
||||
: objectToString(value);
|
||||
}
|
||||
|
||||
module.exports = baseGetTag;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2177:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var baseGetTag = __nccwpck_require__(7497),
|
||||
isObjectLike = __nccwpck_require__(5926);
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
var argsTag = '[object Arguments]';
|
||||
|
||||
/**
|
||||
* The base implementation of `_.isArguments`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||||
*/
|
||||
function baseIsArguments(value) {
|
||||
return isObjectLike(value) && baseGetTag(value) == argsTag;
|
||||
}
|
||||
|
||||
module.exports = baseIsArguments;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2085:
|
||||
/***/ ((module) => {
|
||||
|
||||
/** Detect free variable `global` from Node.js. */
|
||||
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
|
||||
|
||||
module.exports = freeGlobal;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 923:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var Symbol = __nccwpck_require__(9213);
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var nativeObjectToString = objectProto.toString;
|
||||
|
||||
/** Built-in value references. */
|
||||
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
|
||||
|
||||
/**
|
||||
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to query.
|
||||
* @returns {string} Returns the raw `toStringTag`.
|
||||
*/
|
||||
function getRawTag(value) {
|
||||
var isOwn = hasOwnProperty.call(value, symToStringTag),
|
||||
tag = value[symToStringTag];
|
||||
|
||||
try {
|
||||
value[symToStringTag] = undefined;
|
||||
var unmasked = true;
|
||||
} catch (e) {}
|
||||
|
||||
var result = nativeObjectToString.call(value);
|
||||
if (unmasked) {
|
||||
if (isOwn) {
|
||||
value[symToStringTag] = tag;
|
||||
} else {
|
||||
delete value[symToStringTag];
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
module.exports = getRawTag;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9299:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var Symbol = __nccwpck_require__(9213),
|
||||
isArguments = __nccwpck_require__(8495),
|
||||
isArray = __nccwpck_require__(4869);
|
||||
|
||||
/** Built-in value references. */
|
||||
var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined;
|
||||
|
||||
/**
|
||||
* Checks if `value` is a flattenable `arguments` object or array.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is flattenable, else `false`.
|
||||
*/
|
||||
function isFlattenable(value) {
|
||||
return isArray(value) || isArguments(value) ||
|
||||
!!(spreadableSymbol && value && value[spreadableSymbol]);
|
||||
}
|
||||
|
||||
module.exports = isFlattenable;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4200:
|
||||
/***/ ((module) => {
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/**
|
||||
* Used to resolve the
|
||||
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
||||
* of values.
|
||||
*/
|
||||
var nativeObjectToString = objectProto.toString;
|
||||
|
||||
/**
|
||||
* Converts `value` to a string using `Object.prototype.toString`.
|
||||
*
|
||||
* @private
|
||||
* @param {*} value The value to convert.
|
||||
* @returns {string} Returns the converted string.
|
||||
*/
|
||||
function objectToString(value) {
|
||||
return nativeObjectToString.call(value);
|
||||
}
|
||||
|
||||
module.exports = objectToString;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 9882:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var freeGlobal = __nccwpck_require__(2085);
|
||||
|
||||
/** Detect free variable `self`. */
|
||||
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
||||
|
||||
/** Used as a reference to the global object. */
|
||||
var root = freeGlobal || freeSelf || Function('return this')();
|
||||
|
||||
module.exports = root;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 2394:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var baseFlatten = __nccwpck_require__(9588);
|
||||
|
||||
/**
|
||||
* Flattens `array` a single level deep.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Array
|
||||
* @param {Array} array The array to flatten.
|
||||
* @returns {Array} Returns the new flattened array.
|
||||
* @example
|
||||
*
|
||||
* _.flatten([1, [2, [3, [4]], 5]]);
|
||||
* // => [1, 2, [3, [4]], 5]
|
||||
*/
|
||||
function flatten(array) {
|
||||
var length = array == null ? 0 : array.length;
|
||||
return length ? baseFlatten(array, 1) : [];
|
||||
}
|
||||
|
||||
module.exports = flatten;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 8495:
|
||||
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
||||
|
||||
var baseIsArguments = __nccwpck_require__(2177),
|
||||
isObjectLike = __nccwpck_require__(5926);
|
||||
|
||||
/** Used for built-in method references. */
|
||||
var objectProto = Object.prototype;
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
var hasOwnProperty = objectProto.hasOwnProperty;
|
||||
|
||||
/** Built-in value references. */
|
||||
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
|
||||
|
||||
/**
|
||||
* Checks if `value` is likely an `arguments` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
||||
* else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArguments(function() { return arguments; }());
|
||||
* // => true
|
||||
*
|
||||
* _.isArguments([1, 2, 3]);
|
||||
* // => false
|
||||
*/
|
||||
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
||||
return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&
|
||||
!propertyIsEnumerable.call(value, 'callee');
|
||||
};
|
||||
|
||||
module.exports = isArguments;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 4869:
|
||||
/***/ ((module) => {
|
||||
|
||||
/**
|
||||
* Checks if `value` is classified as an `Array` object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 0.1.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isArray([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isArray(document.body.children);
|
||||
* // => false
|
||||
*
|
||||
* _.isArray('abc');
|
||||
* // => false
|
||||
*
|
||||
* _.isArray(_.noop);
|
||||
* // => false
|
||||
*/
|
||||
var isArray = Array.isArray;
|
||||
|
||||
module.exports = isArray;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 5926:
|
||||
/***/ ((module) => {
|
||||
|
||||
/**
|
||||
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
||||
* and has a `typeof` result of "object".
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 4.0.0
|
||||
* @category Lang
|
||||
* @param {*} value The value to check.
|
||||
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
||||
* @example
|
||||
*
|
||||
* _.isObjectLike({});
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike([1, 2, 3]);
|
||||
* // => true
|
||||
*
|
||||
* _.isObjectLike(_.noop);
|
||||
* // => false
|
||||
*
|
||||
* _.isObjectLike(null);
|
||||
* // => false
|
||||
*/
|
||||
function isObjectLike(value) {
|
||||
return value != null && typeof value == 'object';
|
||||
}
|
||||
|
||||
module.exports = isObjectLike;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6228:
|
||||
|
|
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
51
dist/licenses.txt
generated
vendored
51
dist/licenses.txt
generated
vendored
|
@ -134,6 +134,57 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
|
||||
lodash
|
||||
MIT
|
||||
Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
||||
|
||||
Based on Underscore.js, copyright Jeremy Ashkenas,
|
||||
DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
|
||||
|
||||
This software consists of voluntary contributions made by many
|
||||
individuals. For exact contribution history, see the revision history
|
||||
available at https://github.com/lodash/lodash
|
||||
|
||||
The following license applies to all parts of this software except as
|
||||
documented below:
|
||||
|
||||
====
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
====
|
||||
|
||||
Copyright and related rights for sample code are waived via CC0. Sample
|
||||
code is defined as all source code displayed within the prose of the
|
||||
documentation.
|
||||
|
||||
CC0: http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
====
|
||||
|
||||
Files located in the node_modules and vendor directories are externally
|
||||
maintained libraries used by this software which have their own
|
||||
licenses; we recommend you read them, as their terms may differ from the
|
||||
terms above.
|
||||
|
||||
|
||||
micromatch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
|
|
@ -34,10 +34,12 @@
|
|||
"dependencies": {
|
||||
"@actions/core": "1.10.0",
|
||||
"@actions/exec": "1.1.1",
|
||||
"lodash": "^4.17.15",
|
||||
"micromatch": "^4.0.5"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "29.5.2",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/micromatch": "^4.0.2",
|
||||
"@types/node": "20.2.1",
|
||||
"@types/uuid": "9.0.2",
|
||||
|
|
|
@ -4,11 +4,12 @@ import {DiffResult} from './commitSha'
|
|||
import {Inputs} from './inputs'
|
||||
import {
|
||||
getDirnameMaxDepth,
|
||||
gitDiff,
|
||||
gitRenamedFiles,
|
||||
gitSubmoduleDiffSHA,
|
||||
jsonOutput
|
||||
jsonOutput,
|
||||
getAllChangedFiles
|
||||
} from './utils'
|
||||
import flatten from 'lodash/flatten'
|
||||
|
||||
export const getRenamedFiles = async ({
|
||||
inputs,
|
||||
|
@ -68,30 +69,37 @@ export const getRenamedFiles = async ({
|
|||
return renamedFiles.join(inputs.oldNewFilesSeparator)
|
||||
}
|
||||
|
||||
export const getDiffFiles = async ({
|
||||
inputs,
|
||||
export enum ChangeTypeEnum {
|
||||
Added = 'A',
|
||||
Copied = 'C',
|
||||
Deleted = 'D',
|
||||
Modified = 'M',
|
||||
Renamed = 'R',
|
||||
TypeChanged = 'T',
|
||||
Unmerged = 'U',
|
||||
Unknown = 'X'
|
||||
}
|
||||
|
||||
export type ChangedFiles = {
|
||||
[key in ChangeTypeEnum]: string[]
|
||||
}
|
||||
|
||||
export const getAllDiffFiles = async ({
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter,
|
||||
filePatterns = [],
|
||||
submodulePaths
|
||||
}: {
|
||||
inputs: Inputs
|
||||
workingDirectory: string
|
||||
hasSubmodule: boolean
|
||||
diffResult: DiffResult
|
||||
diffFilter: string
|
||||
filePatterns?: string[]
|
||||
submodulePaths: string[]
|
||||
}): Promise<string> => {
|
||||
let files = await gitDiff({
|
||||
}): Promise<ChangedFiles> => {
|
||||
const files = await getAllChangedFiles({
|
||||
cwd: workingDirectory,
|
||||
sha1: diffResult.previousSha,
|
||||
sha2: diffResult.currentSha,
|
||||
diff: diffResult.diff,
|
||||
diffFilter,
|
||||
filePatterns
|
||||
diff: diffResult.diff
|
||||
})
|
||||
|
||||
if (hasSubmodule) {
|
||||
|
@ -110,32 +118,107 @@ export const getDiffFiles = async ({
|
|||
)
|
||||
|
||||
if (submoduleShaResult.currentSha && submoduleShaResult.previousSha) {
|
||||
const submoduleFiles = await gitDiff({
|
||||
const submoduleFiles = await getAllChangedFiles({
|
||||
cwd: submoduleWorkingDirectory,
|
||||
sha1: submoduleShaResult.previousSha,
|
||||
sha2: submoduleShaResult.currentSha,
|
||||
diff: diffResult.diff,
|
||||
diffFilter,
|
||||
isSubmodule: true,
|
||||
filePatterns,
|
||||
parentDir: submodulePath
|
||||
})
|
||||
files.push(...submoduleFiles)
|
||||
|
||||
for (const changeType of Object.keys(
|
||||
submoduleFiles
|
||||
) as ChangeTypeEnum[]) {
|
||||
if (!files[changeType]) {
|
||||
files[changeType] = []
|
||||
}
|
||||
files[changeType].push(...submoduleFiles[changeType])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inputs.dirNames) {
|
||||
files = files.map(file =>
|
||||
getDirnameMaxDepth({
|
||||
pathStr: file,
|
||||
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
|
||||
excludeCurrentDir:
|
||||
inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
|
||||
})
|
||||
)
|
||||
files = [...new Set(files)]
|
||||
return files
|
||||
}
|
||||
|
||||
function* getChangeTypeFilesGenerator({
|
||||
inputs,
|
||||
changedFiles,
|
||||
changeTypes
|
||||
}: {
|
||||
inputs: Inputs
|
||||
changedFiles: ChangedFiles
|
||||
changeTypes: ChangeTypeEnum[]
|
||||
}): Generator<string> {
|
||||
for (const changeType of changeTypes) {
|
||||
const files = changedFiles[changeType] || []
|
||||
for (const file of files) {
|
||||
if (inputs.dirNames) {
|
||||
yield getDirnameMaxDepth({
|
||||
pathStr: file,
|
||||
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
|
||||
excludeCurrentDir:
|
||||
inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
|
||||
})
|
||||
} else {
|
||||
yield file
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getChangeTypeFiles = async ({
|
||||
inputs,
|
||||
changedFiles,
|
||||
changeTypes
|
||||
}: {
|
||||
inputs: Inputs
|
||||
changedFiles: ChangedFiles
|
||||
changeTypes: ChangeTypeEnum[]
|
||||
}): Promise<string> => {
|
||||
const files = [
|
||||
...new Set(getChangeTypeFilesGenerator({inputs, changedFiles, changeTypes}))
|
||||
]
|
||||
|
||||
if (inputs.json) {
|
||||
return jsonOutput({value: files, shouldEscape: inputs.escapeJson})
|
||||
}
|
||||
|
||||
return files.join(inputs.separator)
|
||||
}
|
||||
|
||||
function* getAllChangeTypeFilesGenerator({
|
||||
inputs,
|
||||
changedFiles
|
||||
}: {
|
||||
inputs: Inputs
|
||||
changedFiles: ChangedFiles
|
||||
}): Generator<string> {
|
||||
for (const file of flatten(Object.values(changedFiles))) {
|
||||
if (inputs.dirNames) {
|
||||
yield getDirnameMaxDepth({
|
||||
pathStr: file,
|
||||
dirNamesMaxDepth: inputs.dirNamesMaxDepth,
|
||||
excludeCurrentDir:
|
||||
inputs.dirNamesExcludeRoot || inputs.dirNamesExcludeCurrentDir
|
||||
})
|
||||
} else {
|
||||
yield file
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const getAllChangeTypeFiles = async ({
|
||||
inputs,
|
||||
changedFiles
|
||||
}: {
|
||||
inputs: Inputs
|
||||
changedFiles: ChangedFiles
|
||||
}): Promise<string> => {
|
||||
const files = [
|
||||
...new Set(getAllChangeTypeFilesGenerator({inputs, changedFiles}))
|
||||
]
|
||||
|
||||
if (inputs.json) {
|
||||
return jsonOutput({value: files, shouldEscape: inputs.escapeJson})
|
||||
|
|
|
@ -370,11 +370,22 @@ export const getSHAForPullRequestEvent = async (
|
|||
|
||||
if (!previousSha) {
|
||||
if (inputs.sinceLastRemoteCommit) {
|
||||
previousSha = env.GITHUB_EVENT_BEFORE
|
||||
previousSha =
|
||||
env.GITHUB_EVENT_BEFORE ||
|
||||
(await getRemoteBranchHeadSha({
|
||||
cwd: workingDirectory,
|
||||
branch: currentBranch
|
||||
}))
|
||||
|
||||
if (
|
||||
(await verifyCommitSha({sha: previousSha, cwd: workingDirectory})) !== 0
|
||||
!previousSha ||
|
||||
(previousSha &&
|
||||
(await verifyCommitSha({sha: previousSha, cwd: workingDirectory})) !==
|
||||
0)
|
||||
) {
|
||||
core.warning(
|
||||
'Unable to locate the remote branch head sha. Falling back to the pull request base sha.'
|
||||
)
|
||||
previousSha = env.GITHUB_EVENT_PULL_REQUEST_BASE_SHA
|
||||
}
|
||||
} else {
|
||||
|
|
180
src/main.ts
180
src/main.ts
|
@ -1,15 +1,22 @@
|
|||
import * as core from '@actions/core'
|
||||
import path from 'path'
|
||||
import {getDiffFiles, getRenamedFiles} from './changedFiles'
|
||||
import {
|
||||
getAllChangeTypeFiles,
|
||||
getAllDiffFiles,
|
||||
getChangeTypeFiles,
|
||||
getRenamedFiles,
|
||||
ChangeTypeEnum
|
||||
} from './changedFiles'
|
||||
import {
|
||||
DiffResult,
|
||||
getSHAForPullRequestEvent,
|
||||
getSHAForPushEvent,
|
||||
DiffResult
|
||||
getSHAForPushEvent
|
||||
} from './commitSha'
|
||||
import {getEnv} from './env'
|
||||
import {getInputs} from './inputs'
|
||||
import {
|
||||
getFilePatterns,
|
||||
getFilteredChangedFiles,
|
||||
getSubmodulePath,
|
||||
isRepoShallow,
|
||||
setOutput,
|
||||
|
@ -105,16 +112,27 @@ export async function run(): Promise<void> {
|
|||
inputs,
|
||||
workingDirectory
|
||||
})
|
||||
core.debug(`File patterns: ${filePatterns}`)
|
||||
|
||||
const addedFiles = await getDiffFiles({
|
||||
inputs,
|
||||
const allDiffFiles = await getAllDiffFiles({
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'A',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
})
|
||||
core.debug(`All diff files: ${JSON.stringify(allDiffFiles)}`)
|
||||
|
||||
const allFilteredDiffFiles = await getFilteredChangedFiles({
|
||||
allDiffFiles,
|
||||
filePatterns
|
||||
})
|
||||
core.debug(`All filtered diff files: ${JSON.stringify(allFilteredDiffFiles)}`)
|
||||
|
||||
const addedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Added]
|
||||
})
|
||||
core.debug(`Added files: ${addedFiles}`)
|
||||
await setOutput({
|
||||
key: 'added_files',
|
||||
|
@ -122,14 +140,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const copiedFiles = await getDiffFiles({
|
||||
const copiedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'C',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Copied]
|
||||
})
|
||||
core.debug(`Copied files: ${copiedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -138,14 +152,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const modifiedFiles = await getDiffFiles({
|
||||
const modifiedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'M',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Modified]
|
||||
})
|
||||
core.debug(`Modified files: ${modifiedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -154,14 +164,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const renamedFiles = await getDiffFiles({
|
||||
const renamedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'R',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Renamed]
|
||||
})
|
||||
core.debug(`Renamed files: ${renamedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -170,14 +176,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const typeChangedFiles = await getDiffFiles({
|
||||
const typeChangedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'T',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.TypeChanged]
|
||||
})
|
||||
core.debug(`Type changed files: ${typeChangedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -186,14 +188,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const unmergedFiles = await getDiffFiles({
|
||||
const unmergedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'U',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Unmerged]
|
||||
})
|
||||
core.debug(`Unmerged files: ${unmergedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -202,14 +200,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const unknownFiles = await getDiffFiles({
|
||||
const unknownFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'X',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Unknown]
|
||||
})
|
||||
core.debug(`Unknown files: ${unknownFiles}`)
|
||||
await setOutput({
|
||||
|
@ -218,14 +212,9 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const allChangedAndModifiedFiles = await getDiffFiles({
|
||||
const allChangedAndModifiedFiles = await getAllChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACDMRTUX',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles
|
||||
})
|
||||
core.debug(`All changed and modified files: ${allChangedAndModifiedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -234,14 +223,15 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const allChangedFiles = await getDiffFiles({
|
||||
const allChangedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMR',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [
|
||||
ChangeTypeEnum.Added,
|
||||
ChangeTypeEnum.Copied,
|
||||
ChangeTypeEnum.Modified,
|
||||
ChangeTypeEnum.Renamed
|
||||
]
|
||||
})
|
||||
core.debug(`All changed files: ${allChangedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -256,13 +246,15 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const allOtherChangedFiles = await getDiffFiles({
|
||||
const allOtherChangedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMR',
|
||||
submodulePaths
|
||||
changedFiles: allDiffFiles,
|
||||
changeTypes: [
|
||||
ChangeTypeEnum.Added,
|
||||
ChangeTypeEnum.Copied,
|
||||
ChangeTypeEnum.Modified,
|
||||
ChangeTypeEnum.Renamed
|
||||
]
|
||||
})
|
||||
core.debug(`All other changed files: ${allOtherChangedFiles}`)
|
||||
|
||||
|
@ -289,14 +281,16 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const allModifiedFiles = await getDiffFiles({
|
||||
const allModifiedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMRD',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [
|
||||
ChangeTypeEnum.Added,
|
||||
ChangeTypeEnum.Copied,
|
||||
ChangeTypeEnum.Modified,
|
||||
ChangeTypeEnum.Renamed,
|
||||
ChangeTypeEnum.Deleted
|
||||
]
|
||||
})
|
||||
core.debug(`All modified files: ${allModifiedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -311,13 +305,16 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const allOtherModifiedFiles = await getDiffFiles({
|
||||
const allOtherModifiedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'ACMRD',
|
||||
submodulePaths
|
||||
changedFiles: allDiffFiles,
|
||||
changeTypes: [
|
||||
ChangeTypeEnum.Added,
|
||||
ChangeTypeEnum.Copied,
|
||||
ChangeTypeEnum.Modified,
|
||||
ChangeTypeEnum.Renamed,
|
||||
ChangeTypeEnum.Deleted
|
||||
]
|
||||
})
|
||||
|
||||
const otherModifiedFiles = allOtherModifiedFiles
|
||||
|
@ -343,14 +340,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const deletedFiles = await getDiffFiles({
|
||||
const deletedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'D',
|
||||
filePatterns,
|
||||
submodulePaths
|
||||
changedFiles: allFilteredDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Deleted]
|
||||
})
|
||||
core.debug(`Deleted files: ${deletedFiles}`)
|
||||
await setOutput({
|
||||
|
@ -365,13 +358,10 @@ export async function run(): Promise<void> {
|
|||
inputs
|
||||
})
|
||||
|
||||
const allOtherDeletedFiles = await getDiffFiles({
|
||||
const allOtherDeletedFiles = await getChangeTypeFiles({
|
||||
inputs,
|
||||
workingDirectory,
|
||||
hasSubmodule,
|
||||
diffResult,
|
||||
diffFilter: 'D',
|
||||
submodulePaths
|
||||
changedFiles: allDiffFiles,
|
||||
changeTypes: [ChangeTypeEnum.Deleted]
|
||||
})
|
||||
|
||||
const otherDeletedFiles = allOtherDeletedFiles
|
||||
|
|
89
src/utils.ts
89
src/utils.ts
|
@ -5,6 +5,7 @@ import {createReadStream, promises as fs} from 'fs'
|
|||
import mm from 'micromatch'
|
||||
import * as path from 'path'
|
||||
import {createInterface} from 'readline'
|
||||
import {ChangedFiles, ChangeTypeEnum} from './changedFiles'
|
||||
|
||||
import {Inputs} from './inputs'
|
||||
|
||||
|
@ -403,32 +404,28 @@ export const gitRenamedFiles = async ({
|
|||
})
|
||||
}
|
||||
|
||||
export const gitDiff = async ({
|
||||
export const getAllChangedFiles = async ({
|
||||
cwd,
|
||||
sha1,
|
||||
sha2,
|
||||
diff,
|
||||
diffFilter,
|
||||
filePatterns = [],
|
||||
isSubmodule = false,
|
||||
parentDir = ''
|
||||
}: {
|
||||
cwd: string
|
||||
sha1: string
|
||||
sha2: string
|
||||
diffFilter: string
|
||||
diff: string
|
||||
filePatterns?: string[]
|
||||
isSubmodule?: boolean
|
||||
parentDir?: string
|
||||
}): Promise<string[]> => {
|
||||
}): Promise<ChangedFiles> => {
|
||||
const {exitCode, stdout, stderr} = await exec.getExecOutput(
|
||||
'git',
|
||||
[
|
||||
'diff',
|
||||
'--name-only',
|
||||
'--name-status',
|
||||
'--ignore-submodules=all',
|
||||
`--diff-filter=${diffFilter}`,
|
||||
`--diff-filter=ACDMRTUX`,
|
||||
`${sha1}${diff}${sha2}`
|
||||
],
|
||||
{
|
||||
|
@ -437,6 +434,16 @@ export const gitDiff = async ({
|
|||
silent: process.env.RUNNER_DEBUG !== '1'
|
||||
}
|
||||
)
|
||||
const changedFiles: ChangedFiles = {
|
||||
[ChangeTypeEnum.Added]: [],
|
||||
[ChangeTypeEnum.Copied]: [],
|
||||
[ChangeTypeEnum.Deleted]: [],
|
||||
[ChangeTypeEnum.Modified]: [],
|
||||
[ChangeTypeEnum.Renamed]: [],
|
||||
[ChangeTypeEnum.TypeChanged]: [],
|
||||
[ChangeTypeEnum.Unmerged]: [],
|
||||
[ChangeTypeEnum.Unknown]: []
|
||||
}
|
||||
|
||||
if (exitCode !== 0) {
|
||||
if (isSubmodule) {
|
||||
|
@ -453,28 +460,60 @@ export const gitDiff = async ({
|
|||
)
|
||||
}
|
||||
|
||||
return []
|
||||
return changedFiles
|
||||
}
|
||||
|
||||
const files = stdout
|
||||
.split('\n')
|
||||
.filter(Boolean)
|
||||
.map((p: string) => {
|
||||
if (isSubmodule) {
|
||||
return normalizePath(path.join(parentDir, p))
|
||||
}
|
||||
return normalizePath(p)
|
||||
})
|
||||
const lines = stdout.split('\n').filter(Boolean)
|
||||
|
||||
if (filePatterns.length === 0) {
|
||||
return files
|
||||
for (const line of lines) {
|
||||
const [changeType, filePath] = line.split('\t')
|
||||
const normalizedFilePath = isSubmodule
|
||||
? normalizePath(path.join(parentDir, filePath))
|
||||
: normalizePath(filePath)
|
||||
|
||||
if (changeType.startsWith('R')) {
|
||||
changedFiles[ChangeTypeEnum.Renamed].push(normalizedFilePath)
|
||||
} else {
|
||||
changedFiles[changeType as ChangeTypeEnum].push(normalizedFilePath)
|
||||
}
|
||||
}
|
||||
return changedFiles
|
||||
}
|
||||
|
||||
export const getFilteredChangedFiles = async ({
|
||||
allDiffFiles,
|
||||
filePatterns
|
||||
}: {
|
||||
allDiffFiles: ChangedFiles
|
||||
filePatterns: string[]
|
||||
}): Promise<ChangedFiles> => {
|
||||
const changedFiles: ChangedFiles = {
|
||||
[ChangeTypeEnum.Added]: [],
|
||||
[ChangeTypeEnum.Copied]: [],
|
||||
[ChangeTypeEnum.Deleted]: [],
|
||||
[ChangeTypeEnum.Modified]: [],
|
||||
[ChangeTypeEnum.Renamed]: [],
|
||||
[ChangeTypeEnum.TypeChanged]: [],
|
||||
[ChangeTypeEnum.Unmerged]: [],
|
||||
[ChangeTypeEnum.Unknown]: []
|
||||
}
|
||||
|
||||
return mm(files, filePatterns, {
|
||||
dot: true,
|
||||
windows: IS_WINDOWS,
|
||||
noext: true
|
||||
})
|
||||
for (const changeType of Object.keys(allDiffFiles)) {
|
||||
const files = allDiffFiles[changeType as ChangeTypeEnum]
|
||||
const hasFilePatterns = filePatterns.length > 0
|
||||
|
||||
if (hasFilePatterns) {
|
||||
changedFiles[changeType as ChangeTypeEnum] = mm(files, filePatterns, {
|
||||
dot: true,
|
||||
windows: IS_WINDOWS,
|
||||
noext: true
|
||||
})
|
||||
} else {
|
||||
changedFiles[changeType as ChangeTypeEnum] = files
|
||||
}
|
||||
}
|
||||
|
||||
return changedFiles
|
||||
}
|
||||
|
||||
export const gitLog = async ({
|
||||
|
|
|
@ -1 +1 @@
|
|||
This is a test file with non ascii character in the filename.
|
||||
This is a test file with non ASCII character in the filename.
|
||||
|
|
Loading…
Add table
Reference in a new issue