Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4196030939 | ||
|
|
bbe796033e | ||
|
|
159562dc02 | ||
|
|
a21a533a0c | ||
|
|
eeb169a9f9 | ||
|
|
951140b94a | ||
|
|
dbf0700c7a | ||
|
|
dacbaebcaf | ||
|
|
36ab2fe9c2 | ||
|
|
7e3a4bac80 | ||
|
|
dcbe9805f4 | ||
|
|
fd73c1248c |
@@ -187,6 +187,16 @@
|
||||
"contributions": [
|
||||
"doc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"login": "V0lantis",
|
||||
"name": "Arthur",
|
||||
"avatar_url": "https://avatars.githubusercontent.com/u/37664438?v=4",
|
||||
"profile": "https://arthurvolant.com",
|
||||
"contributions": [
|
||||
"bug",
|
||||
"code"
|
||||
]
|
||||
}
|
||||
],
|
||||
"contributorsPerLine": 7,
|
||||
@@ -195,5 +205,6 @@
|
||||
"repoType": "github",
|
||||
"repoHost": "https://github.com",
|
||||
"skipCi": true,
|
||||
"commitConvention": "angular"
|
||||
"commitConvention": "angular",
|
||||
"commitType": "docs"
|
||||
}
|
||||
|
||||
4
.codacy.yml
Normal file
4
.codacy.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
exclude_paths:
|
||||
- "*.md"
|
||||
- "dist/**"
|
||||
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@@ -845,7 +845,7 @@ jobs:
|
||||
since_last_remote_commit: true
|
||||
|
||||
- name: Verify failed
|
||||
if: steps.changed-files-since-last-remote-commit.outcome != 'failure' && matrix.fetch-depth == 1 && github.event_name != 'push'
|
||||
if: steps.changed-files-since-last-remote-commit.outcome != 'failure' && matrix.fetch-depth == 1 && github.event.action == 'closed' && github.event_name == 'pull_request'
|
||||
run: |
|
||||
echo "Expected: (failure) got ${{ steps.changed-files-since-last-remote-commit.outcome }}"
|
||||
exit 1
|
||||
|
||||
53
HISTORY.md
53
HISTORY.md
@@ -1,5 +1,58 @@
|
||||
# Changelog
|
||||
|
||||
# [39.1.1](https://github.com/tj-actions/changed-files/compare/v39.1.0...v39.1.1) - (2023-09-19)
|
||||
|
||||
## <!-- 1 -->🐛 Bug Fixes
|
||||
|
||||
- Changed_keys and modified_keys output to handle json and escape_json inputs ([#1585](https://github.com/tj-actions/changed-files/issues/1585)) ([951140b](https://github.com/tj-actions/changed-files/commit/951140b94a6a58dd2c62d7fb0b4d73898c79b196)) - (Arthur)
|
||||
- Error with test ([#1589](https://github.com/tj-actions/changed-files/issues/1589)) ([dbf0700](https://github.com/tj-actions/changed-files/commit/dbf0700c7ac336b1ceed2ac8fe1b02d4cd3ac84f)) - (Tonye Jack)
|
||||
|
||||
## <!-- 26 -->🔄 Update
|
||||
|
||||
- Update test.yml ([a21a533](https://github.com/tj-actions/changed-files/commit/a21a533a0c244a27daac02f9dc6fcf8aeb996154)) - (Tonye Jack)
|
||||
- Updated README.md ([#1588](https://github.com/tj-actions/changed-files/issues/1588))
|
||||
|
||||
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([dacbaeb](https://github.com/tj-actions/changed-files/commit/dacbaebcaf9428d083702ffa9b449bac799dd2c3)) - (tj-actions[bot])
|
||||
|
||||
## <!-- 3 -->📚 Documentation
|
||||
|
||||
- Add V0lantis as a contributor for bug ([#1587](https://github.com/tj-actions/changed-files/issues/1587)) ([36ab2fe](https://github.com/tj-actions/changed-files/commit/36ab2fe9c2c58212caac6853d9b8e205a4d5c84b)) - (allcontributors[bot])
|
||||
|
||||
## <!-- 7 -->⚙️ Miscellaneous Tasks
|
||||
|
||||
- Add codacy config ([#1590](https://github.com/tj-actions/changed-files/issues/1590)) ([eeb169a](https://github.com/tj-actions/changed-files/commit/eeb169a9f925d0d92ff3dea3ac356ff0d5f288a8)) - (Tonye Jack)
|
||||
- Update test.yml ([#1586](https://github.com/tj-actions/changed-files/issues/1586)) ([7e3a4ba](https://github.com/tj-actions/changed-files/commit/7e3a4bac80a0d6fdd60b44fea0dc5fa781ca8177)) - (Tonye Jack)
|
||||
- Move variable declaration ([#1584](https://github.com/tj-actions/changed-files/issues/1584)) ([dcbe980](https://github.com/tj-actions/changed-files/commit/dcbe9805f4bb9e5128d8c802e2517943b4c09aa0)) - (Tonye Jack)
|
||||
|
||||
## <!-- 9 -->⬆️ Upgrades
|
||||
|
||||
- Upgraded to v39.1.0 ([#1583](https://github.com/tj-actions/changed-files/issues/1583))
|
||||
|
||||
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([fd73c12](https://github.com/tj-actions/changed-files/commit/fd73c1248c8bebea8b243083223002698432c2a0)) - (tj-actions[bot])
|
||||
|
||||
# [39.1.0](https://github.com/tj-actions/changed-files/compare/v39.0.3...v39.1.0) - (2023-09-18)
|
||||
|
||||
## <!-- 0 -->🚀 Features
|
||||
|
||||
- Add support for returning YAML keys for paths that have changed ([#1581](https://github.com/tj-actions/changed-files/issues/1581)) ([5db7b57](https://github.com/tj-actions/changed-files/commit/5db7b578d50867ab5781bf9d867e7650b5b39fc4)) - (Tonye Jack)
|
||||
|
||||
## <!-- 26 -->🔄 Update
|
||||
|
||||
- Updated README.md ([#1582](https://github.com/tj-actions/changed-files/issues/1582))
|
||||
|
||||
Co-authored-by: repo-ranger[bot] <repo-ranger[bot]@users.noreply.github.com> ([8e79ba7](https://github.com/tj-actions/changed-files/commit/8e79ba7ab9fee9984275219aeb2c8db47bcb8a2d)) - (tj-actions[bot])
|
||||
|
||||
## <!-- 7 -->⚙️ Miscellaneous Tasks
|
||||
|
||||
- **deps:** Update typescript-eslint monorepo to v6.7.2 ([a17e8c5](https://github.com/tj-actions/changed-files/commit/a17e8c5252f6c9982b161714c528708a7f445479)) - (renovate[bot])
|
||||
- **deps:** Lock file maintenance ([d1e9506](https://github.com/tj-actions/changed-files/commit/d1e9506b19d9c3a4053191d616b1ac09de1dfa55)) - (renovate[bot])
|
||||
|
||||
## <!-- 9 -->⬆️ Upgrades
|
||||
|
||||
- Upgraded to v39.0.3 ([#1577](https://github.com/tj-actions/changed-files/issues/1577))
|
||||
|
||||
Co-authored-by: jackton1 <jackton1@users.noreply.github.com> ([1fdfe09](https://github.com/tj-actions/changed-files/commit/1fdfe0928a9a55323f0d333ecf6ccfca8c6d73c9)) - (tj-actions[bot])
|
||||
|
||||
# [39.0.3](https://github.com/tj-actions/changed-files/compare/v39.0.2...v39.0.3) - (2023-09-17)
|
||||
|
||||
## <!-- 26 -->🔄 Update
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
||||
|
||||
[](#contributors-)
|
||||
[](#contributors-)
|
||||
|
||||
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
||||
|
||||
@@ -1011,6 +1011,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/adonisgarciac"><img src="https://avatars.githubusercontent.com/u/71078987?v=4?s=100" width="100px;" alt="adonisgarciac"/><br /><sub><b>adonisgarciac</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=adonisgarciac" title="Code">💻</a> <a href="https://github.com/tj-actions/changed-files/commits?author=adonisgarciac" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/cfernhout"><img src="https://avatars.githubusercontent.com/u/22294606?v=4?s=100" width="100px;" alt="Chiel Fernhout"/><br /><sub><b>Chiel Fernhout</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=cfernhout" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://github.com/albertoperdomo2"><img src="https://avatars.githubusercontent.com/u/62241095?v=4?s=100" width="100px;" alt="Alberto Perdomo"/><br /><sub><b>Alberto Perdomo</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/commits?author=albertoperdomo2" title="Documentation">📖</a></td>
|
||||
<td align="center" valign="top" width="14.28%"><a href="https://arthurvolant.com"><img src="https://avatars.githubusercontent.com/u/37664438?v=4?s=100" width="100px;" alt="Arthur"/><br /><sub><b>Arthur</b></sub></a><br /><a href="https://github.com/tj-actions/changed-files/issues?q=author%3AV0lantis" title="Bug reports">🐛</a> <a href="https://github.com/tj-actions/changed-files/commits?author=V0lantis" title="Code">💻</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
147
dist/index.js
generated
vendored
147
dist/index.js
generated
vendored
@@ -74,9 +74,9 @@ const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatte
|
||||
core.info('All Done!');
|
||||
core.endGroup();
|
||||
}
|
||||
const modifiedKeys = [];
|
||||
const changedKeys = [];
|
||||
if (Object.keys(yamlFilePatterns).length > 0) {
|
||||
const modifiedKeys = [];
|
||||
const changedKeys = [];
|
||||
for (const key of Object.keys(yamlFilePatterns)) {
|
||||
core.startGroup(`changed-files-yaml-${key}`);
|
||||
const allFilteredDiffFiles = yield (0, utils_1.getFilteredChangedFiles)({
|
||||
@@ -101,21 +101,17 @@ const processChangedFiles = ({ filePatterns, allDiffFiles, inputs, yamlFilePatte
|
||||
core.endGroup();
|
||||
}
|
||||
if (modifiedKeys.length > 0) {
|
||||
yield (0, utils_1.setOutput)({
|
||||
yield (0, utils_1.setArrayOutput)({
|
||||
key: 'modified_keys',
|
||||
value: modifiedKeys.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
inputs,
|
||||
value: modifiedKeys
|
||||
});
|
||||
}
|
||||
if (changedKeys.length > 0) {
|
||||
yield (0, utils_1.setOutput)({
|
||||
yield (0, utils_1.setArrayOutput)({
|
||||
key: 'changed_keys',
|
||||
value: changedKeys.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
inputs,
|
||||
value: changedKeys
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -435,9 +431,6 @@ exports.setOutputsAndGetModifiedAndChangedFilesStatus = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const changedFiles_1 = __nccwpck_require__(7358);
|
||||
const utils_1 = __nccwpck_require__(918);
|
||||
const getOutputKey = (key, outputPrefix) => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key;
|
||||
};
|
||||
const getArrayFromPaths = (paths, inputs) => {
|
||||
return Array.isArray(paths) ? paths : paths.split(inputs.separator);
|
||||
};
|
||||
@@ -449,7 +442,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Added files: ${JSON.stringify(addedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('added_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('added_files', outputPrefix),
|
||||
value: addedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -457,7 +450,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('added_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('added_files_count', outputPrefix),
|
||||
value: addedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -469,7 +462,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Copied files: ${JSON.stringify(copiedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('copied_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('copied_files', outputPrefix),
|
||||
value: copiedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -477,7 +470,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('copied_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('copied_files_count', outputPrefix),
|
||||
value: copiedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -489,7 +482,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Modified files: ${JSON.stringify(modifiedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('modified_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('modified_files', outputPrefix),
|
||||
value: modifiedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -497,7 +490,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('modified_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('modified_files_count', outputPrefix),
|
||||
value: modifiedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -509,7 +502,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Renamed files: ${JSON.stringify(renamedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('renamed_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('renamed_files', outputPrefix),
|
||||
value: renamedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -517,7 +510,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('renamed_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('renamed_files_count', outputPrefix),
|
||||
value: renamedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -529,7 +522,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Type changed files: ${JSON.stringify(typeChangedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('type_changed_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('type_changed_files', outputPrefix),
|
||||
value: typeChangedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -537,7 +530,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('type_changed_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('type_changed_files_count', outputPrefix),
|
||||
value: typeChangedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -549,7 +542,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Unmerged files: ${JSON.stringify(unmergedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('unmerged_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('unmerged_files', outputPrefix),
|
||||
value: unmergedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -557,7 +550,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('unmerged_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('unmerged_files_count', outputPrefix),
|
||||
value: unmergedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -569,7 +562,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Unknown files: ${JSON.stringify(unknownFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('unknown_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('unknown_files', outputPrefix),
|
||||
value: unknownFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -577,7 +570,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('unknown_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('unknown_files_count', outputPrefix),
|
||||
value: unknownFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -588,7 +581,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`All changed and modified files: ${JSON.stringify(allChangedAndModifiedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('all_changed_and_modified_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('all_changed_and_modified_files', outputPrefix),
|
||||
value: allChangedAndModifiedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -596,7 +589,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('all_changed_and_modified_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('all_changed_and_modified_files_count', outputPrefix),
|
||||
value: allChangedAndModifiedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -613,7 +606,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`All changed files: ${JSON.stringify(allChangedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('all_changed_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('all_changed_files', outputPrefix),
|
||||
value: allChangedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -621,13 +614,13 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('all_changed_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('all_changed_files_count', outputPrefix),
|
||||
value: allChangedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('any_changed', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('any_changed', outputPrefix),
|
||||
value: allChangedFiles.paths.length > 0 && filePatterns.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -651,24 +644,20 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
allChangedFiles.paths.length > 0 &&
|
||||
filePatterns.length > 0;
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('only_changed', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('only_changed', outputPrefix),
|
||||
value: onlyChanged,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('other_changed_files', outputPrefix),
|
||||
value: inputs.json
|
||||
? otherChangedFiles
|
||||
: otherChangedFiles.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
yield (0, utils_1.setArrayOutput)({
|
||||
key: 'other_changed_files',
|
||||
inputs,
|
||||
value: otherChangedFiles,
|
||||
outputPrefix
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('other_changed_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('other_changed_files_count', outputPrefix),
|
||||
value: otherChangedFiles.length.toString(),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -686,7 +675,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`All modified files: ${JSON.stringify(allModifiedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('all_modified_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('all_modified_files', outputPrefix),
|
||||
value: allModifiedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -694,13 +683,13 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('all_modified_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('all_modified_files_count', outputPrefix),
|
||||
value: allModifiedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('any_modified', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('any_modified', outputPrefix),
|
||||
value: allModifiedFiles.paths.length > 0 && filePatterns.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -724,24 +713,20 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
allModifiedFiles.paths.length > 0 &&
|
||||
filePatterns.length > 0;
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('only_modified', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('only_modified', outputPrefix),
|
||||
value: onlyModified,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('other_modified_files', outputPrefix),
|
||||
value: inputs.json
|
||||
? otherModifiedFiles
|
||||
: otherModifiedFiles.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
yield (0, utils_1.setArrayOutput)({
|
||||
key: 'other_modified_files',
|
||||
inputs,
|
||||
value: otherModifiedFiles,
|
||||
outputPrefix
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('other_modified_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('other_modified_files_count', outputPrefix),
|
||||
value: otherModifiedFiles.length.toString(),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -753,7 +738,7 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
});
|
||||
core.debug(`Deleted files: ${JSON.stringify(deletedFiles)}`);
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('deleted_files', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('deleted_files', outputPrefix),
|
||||
value: deletedFiles.paths,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -761,13 +746,13 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('deleted_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('deleted_files_count', outputPrefix),
|
||||
value: deletedFiles.count,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('any_deleted', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('any_deleted', outputPrefix),
|
||||
value: deletedFiles.paths.length > 0 && filePatterns.length > 0,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
@@ -785,24 +770,20 @@ const setOutputsAndGetModifiedAndChangedFilesStatus = ({ allDiffFiles, allFilter
|
||||
deletedFiles.paths.length > 0 &&
|
||||
filePatterns.length > 0;
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('only_deleted', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('only_deleted', outputPrefix),
|
||||
value: onlyDeleted,
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('other_deleted_files', outputPrefix),
|
||||
value: inputs.json
|
||||
? otherDeletedFiles
|
||||
: otherDeletedFiles.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
yield (0, utils_1.setArrayOutput)({
|
||||
key: 'other_deleted_files',
|
||||
inputs,
|
||||
value: otherDeletedFiles,
|
||||
outputPrefix
|
||||
});
|
||||
yield (0, utils_1.setOutput)({
|
||||
key: getOutputKey('other_deleted_files_count', outputPrefix),
|
||||
key: (0, utils_1.getOutputKey)('other_deleted_files_count', outputPrefix),
|
||||
value: otherDeletedFiles.length.toString(),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir
|
||||
@@ -1280,6 +1261,8 @@ const getSHAForPullRequestEvent = (inputs, env, workingDirectory, isShallow, has
|
||||
sha2: currentSha,
|
||||
diff
|
||||
}))) {
|
||||
core.warning('If this pull request is from a forked repository, please set the checkout action `repository` input to the same repository as the pull request.');
|
||||
core.warning('This can be done by setting actions/checkout `repository` to ${{ github.event.pull_request.head.repo.full_name }}');
|
||||
throw new Error(`Unable to determine a difference between ${previousSha}${diff}${currentSha}`);
|
||||
}
|
||||
if (previousSha === currentSha) {
|
||||
@@ -1882,7 +1865,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.hasLocalGitDirectory = exports.recoverDeletedFiles = exports.setOutput = 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.verifyMinimumGitVersion = exports.getDirname = exports.normalizeSeparators = exports.isWindows = void 0;
|
||||
/*global AsyncIterableIterator*/
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const exec = __importStar(__nccwpck_require__(1514));
|
||||
@@ -2703,6 +2686,22 @@ const getRecoverFilePatterns = ({ inputs }) => {
|
||||
return filePatterns.filter(Boolean);
|
||||
};
|
||||
exports.getRecoverFilePatterns = getRecoverFilePatterns;
|
||||
const getOutputKey = (key, outputPrefix) => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key;
|
||||
};
|
||||
exports.getOutputKey = getOutputKey;
|
||||
const setArrayOutput = ({ key, inputs, value, outputPrefix }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
core.debug(`${key}: ${JSON.stringify(value)}`);
|
||||
yield (0, exports.setOutput)({
|
||||
key: outputPrefix ? (0, exports.getOutputKey)(key, outputPrefix) : key,
|
||||
value: inputs.json ? value : value.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
});
|
||||
});
|
||||
exports.setArrayOutput = setArrayOutput;
|
||||
const setOutput = ({ key, value, writeOutputFiles, outputDir, json = false, shouldEscape = false }) => __awaiter(void 0, void 0, void 0, function* () {
|
||||
let cleanedValue;
|
||||
if (json) {
|
||||
|
||||
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
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@tj-actions/changed-files",
|
||||
"version": "39.0.3",
|
||||
"version": "39.1.1",
|
||||
"description": "Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.",
|
||||
"main": "lib/main.js",
|
||||
"publishConfig": {
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
gitSubmoduleDiffSHA,
|
||||
isWindows,
|
||||
jsonOutput,
|
||||
setOutput
|
||||
setArrayOutput
|
||||
} from './utils'
|
||||
|
||||
export const processChangedFiles = async ({
|
||||
@@ -50,10 +50,10 @@ export const processChangedFiles = async ({
|
||||
core.endGroup()
|
||||
}
|
||||
|
||||
const modifiedKeys: string[] = []
|
||||
const changedKeys: string[] = []
|
||||
|
||||
if (Object.keys(yamlFilePatterns).length > 0) {
|
||||
const modifiedKeys: string[] = []
|
||||
const changedKeys: string[] = []
|
||||
|
||||
for (const key of Object.keys(yamlFilePatterns)) {
|
||||
core.startGroup(`changed-files-yaml-${key}`)
|
||||
const allFilteredDiffFiles = await getFilteredChangedFiles({
|
||||
@@ -85,22 +85,18 @@ export const processChangedFiles = async ({
|
||||
}
|
||||
|
||||
if (modifiedKeys.length > 0) {
|
||||
await setOutput({
|
||||
await setArrayOutput({
|
||||
key: 'modified_keys',
|
||||
value: modifiedKeys.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
inputs,
|
||||
value: modifiedKeys
|
||||
})
|
||||
}
|
||||
|
||||
if (changedKeys.length > 0) {
|
||||
await setOutput({
|
||||
await setArrayOutput({
|
||||
key: 'changed_keys',
|
||||
value: changedKeys.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json
|
||||
inputs,
|
||||
value: changedKeys
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,7 @@ import {
|
||||
getChangeTypeFiles
|
||||
} from './changedFiles'
|
||||
import {Inputs} from './inputs'
|
||||
import {setOutput} from './utils'
|
||||
|
||||
const getOutputKey = (key: string, outputPrefix: string): string => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key
|
||||
}
|
||||
import {getOutputKey, setArrayOutput, setOutput} from './utils'
|
||||
|
||||
const getArrayFromPaths = (
|
||||
paths: string | string[],
|
||||
@@ -283,15 +279,11 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_changed_files', outputPrefix),
|
||||
value: inputs.json
|
||||
? otherChangedFiles
|
||||
: otherChangedFiles.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
await setArrayOutput({
|
||||
key: 'other_changed_files',
|
||||
inputs,
|
||||
value: otherChangedFiles,
|
||||
outputPrefix
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -376,15 +368,11 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_modified_files', outputPrefix),
|
||||
value: inputs.json
|
||||
? otherModifiedFiles
|
||||
: otherModifiedFiles.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
await setArrayOutput({
|
||||
key: 'other_modified_files',
|
||||
inputs,
|
||||
value: otherModifiedFiles,
|
||||
outputPrefix
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
@@ -457,15 +445,11 @@ export const setOutputsAndGetModifiedAndChangedFilesStatus = async ({
|
||||
json: inputs.json
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
key: getOutputKey('other_deleted_files', outputPrefix),
|
||||
value: inputs.json
|
||||
? otherDeletedFiles
|
||||
: otherDeletedFiles.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
await setArrayOutput({
|
||||
key: 'other_deleted_files',
|
||||
inputs,
|
||||
value: otherDeletedFiles,
|
||||
outputPrefix
|
||||
})
|
||||
|
||||
await setOutput({
|
||||
|
||||
@@ -551,6 +551,12 @@ export const getSHAForPullRequestEvent = async (
|
||||
diff
|
||||
}))
|
||||
) {
|
||||
core.warning(
|
||||
'If this pull request is from a forked repository, please set the checkout action `repository` input to the same repository as the pull request.'
|
||||
)
|
||||
core.warning(
|
||||
'This can be done by setting actions/checkout `repository` to ${{ github.event.pull_request.head.repo.full_name }}'
|
||||
)
|
||||
throw new Error(
|
||||
`Unable to determine a difference between ${previousSha}${diff}${currentSha}`
|
||||
)
|
||||
|
||||
26
src/utils.ts
26
src/utils.ts
@@ -1222,6 +1222,32 @@ export const getRecoverFilePatterns = ({
|
||||
return filePatterns.filter(Boolean)
|
||||
}
|
||||
|
||||
export const getOutputKey = (key: string, outputPrefix: string): string => {
|
||||
return outputPrefix ? `${outputPrefix}_${key}` : key
|
||||
}
|
||||
|
||||
export const setArrayOutput = async ({
|
||||
key,
|
||||
inputs,
|
||||
value,
|
||||
outputPrefix
|
||||
}: {
|
||||
key: string
|
||||
inputs: Inputs
|
||||
value: string[]
|
||||
outputPrefix?: string
|
||||
}): Promise<void> => {
|
||||
core.debug(`${key}: ${JSON.stringify(value)}`)
|
||||
await setOutput({
|
||||
key: outputPrefix ? getOutputKey(key, outputPrefix) : key,
|
||||
value: inputs.json ? value : value.join(inputs.separator),
|
||||
writeOutputFiles: inputs.writeOutputFiles,
|
||||
outputDir: inputs.outputDir,
|
||||
json: inputs.json,
|
||||
shouldEscape: inputs.escapeJson
|
||||
})
|
||||
}
|
||||
|
||||
export const setOutput = async ({
|
||||
key,
|
||||
value,
|
||||
|
||||
@@ -972,9 +972,9 @@
|
||||
"@types/braces" "*"
|
||||
|
||||
"@types/node@*", "@types/node@^20.3.2":
|
||||
version "20.6.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.2.tgz#a065925409f59657022e9063275cd0b9bd7e1b12"
|
||||
integrity sha512-Y+/1vGBHV/cYk6OI1Na/LHzwnlNCAfU3ZNGrc1LdRe/LAIbdDPTTv/HU3M7yXN448aTVDq3eKRm2cg7iKLb8gw==
|
||||
version "20.6.3"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.6.3.tgz#5b763b321cd3b80f6b8dde7a37e1a77ff9358dd9"
|
||||
integrity sha512-HksnYH4Ljr4VQgEy2lTStbCKv/P590tmPe5HqOnv9Gprffgv5WXAY+Y5Gqniu0GGqeTCUdBnzC3QSrzPkBkAMA==
|
||||
|
||||
"@types/semver@^7.3.12", "@types/semver@^7.5.0":
|
||||
version "7.5.2"
|
||||
|
||||
Reference in New Issue
Block a user