feat: add support for include/exclude all nested files when a directory is specified and ends with a slash (#1873)
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
cbd59070e8
commit
ae82ed4ae0
18
dist/index.js
generated
vendored
18
dist/index.js
generated
vendored
@ -2105,17 +2105,17 @@ function lineOfFileGenerator({ filePath, excludedFiles }) {
|
|||||||
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a; _d = true) {
|
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield __await(rl_1.next()), _a = rl_1_1.done, !_a; _d = true) {
|
||||||
_c = rl_1_1.value;
|
_c = rl_1_1.value;
|
||||||
_d = false;
|
_d = false;
|
||||||
const line = _c;
|
let line = _c;
|
||||||
if (!line.startsWith('#') && line !== '') {
|
if (!line.startsWith('#') && line !== '') {
|
||||||
if (excludedFiles) {
|
if (excludedFiles) {
|
||||||
if (line.startsWith('!')) {
|
line = line.startsWith('!') ? line : `!${line}`;
|
||||||
|
if (line.endsWith(path.sep)) {
|
||||||
|
line = `${line}**`;
|
||||||
|
}
|
||||||
yield yield __await(line);
|
yield yield __await(line);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
yield yield __await(`!${line}`);
|
line = line.endsWith(path.sep) ? `${line}**` : line;
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield yield __await(line);
|
yield yield __await(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2639,6 +2639,7 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
|
|||||||
if (inputs.files) {
|
if (inputs.files) {
|
||||||
const filesPatterns = inputs.files
|
const filesPatterns = inputs.files
|
||||||
.split(inputs.filesSeparator)
|
.split(inputs.filesSeparator)
|
||||||
|
.map(p => (p.endsWith(path.sep) ? `${p}**` : p))
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
cleanedFilePatterns.push(...filesPatterns);
|
cleanedFilePatterns.push(...filesPatterns);
|
||||||
core.debug(`files patterns: ${filesPatterns.join('\n')}`);
|
core.debug(`files patterns: ${filesPatterns.join('\n')}`);
|
||||||
@ -2660,8 +2661,9 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
|
|||||||
.split(inputs.filesIgnoreSeparator)
|
.split(inputs.filesIgnoreSeparator)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map(p => {
|
.map(p => {
|
||||||
if (!p.startsWith('!')) {
|
p = p.startsWith('!') ? p : `!${p}`;
|
||||||
p = `!${p}`;
|
if (p.endsWith(path.sep)) {
|
||||||
|
p = `${p}**`;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
});
|
});
|
||||||
|
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
17
src/utils.ts
17
src/utils.ts
@ -171,15 +171,16 @@ async function* lineOfFileGenerator({
|
|||||||
input: fileStream,
|
input: fileStream,
|
||||||
crlfDelay: Infinity
|
crlfDelay: Infinity
|
||||||
})
|
})
|
||||||
for await (const line of rl) {
|
for await (let line of rl) {
|
||||||
if (!line.startsWith('#') && line !== '') {
|
if (!line.startsWith('#') && line !== '') {
|
||||||
if (excludedFiles) {
|
if (excludedFiles) {
|
||||||
if (line.startsWith('!')) {
|
line = line.startsWith('!') ? line : `!${line}`
|
||||||
|
if (line.endsWith(path.sep)) {
|
||||||
|
line = `${line}**`
|
||||||
|
}
|
||||||
yield line
|
yield line
|
||||||
} else {
|
} else {
|
||||||
yield `!${line}`
|
line = line.endsWith(path.sep) ? `${line}**` : line
|
||||||
}
|
|
||||||
} else {
|
|
||||||
yield line
|
yield line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -998,6 +999,7 @@ export const getFilePatterns = async ({
|
|||||||
if (inputs.files) {
|
if (inputs.files) {
|
||||||
const filesPatterns = inputs.files
|
const filesPatterns = inputs.files
|
||||||
.split(inputs.filesSeparator)
|
.split(inputs.filesSeparator)
|
||||||
|
.map(p => (p.endsWith(path.sep) ? `${p}**` : p))
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
|
|
||||||
cleanedFilePatterns.push(...filesPatterns)
|
cleanedFilePatterns.push(...filesPatterns)
|
||||||
@ -1029,8 +1031,9 @@ export const getFilePatterns = async ({
|
|||||||
.split(inputs.filesIgnoreSeparator)
|
.split(inputs.filesIgnoreSeparator)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
.map(p => {
|
.map(p => {
|
||||||
if (!p.startsWith('!')) {
|
p = p.startsWith('!') ? p : `!${p}`
|
||||||
p = `!${p}`
|
if (p.endsWith(path.sep)) {
|
||||||
|
p = `${p}**`
|
||||||
}
|
}
|
||||||
return p
|
return p
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user