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) {
|
||||
_c = rl_1_1.value;
|
||||
_d = false;
|
||||
const line = _c;
|
||||
let line = _c;
|
||||
if (!line.startsWith('#') && line !== '') {
|
||||
if (excludedFiles) {
|
||||
if (line.startsWith('!')) {
|
||||
yield yield __await(line);
|
||||
}
|
||||
else {
|
||||
yield yield __await(`!${line}`);
|
||||
line = line.startsWith('!') ? line : `!${line}`;
|
||||
if (line.endsWith(path.sep)) {
|
||||
line = `${line}**`;
|
||||
}
|
||||
yield yield __await(line);
|
||||
}
|
||||
else {
|
||||
line = line.endsWith(path.sep) ? `${line}**` : line;
|
||||
yield yield __await(line);
|
||||
}
|
||||
}
|
||||
@ -2639,6 +2639,7 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
|
||||
if (inputs.files) {
|
||||
const filesPatterns = inputs.files
|
||||
.split(inputs.filesSeparator)
|
||||
.map(p => (p.endsWith(path.sep) ? `${p}**` : p))
|
||||
.filter(Boolean);
|
||||
cleanedFilePatterns.push(...filesPatterns);
|
||||
core.debug(`files patterns: ${filesPatterns.join('\n')}`);
|
||||
@ -2660,8 +2661,9 @@ const getFilePatterns = ({ inputs, workingDirectory }) => __awaiter(void 0, void
|
||||
.split(inputs.filesIgnoreSeparator)
|
||||
.filter(Boolean)
|
||||
.map(p => {
|
||||
if (!p.startsWith('!')) {
|
||||
p = `!${p}`;
|
||||
p = p.startsWith('!') ? p : `!${p}`;
|
||||
if (p.endsWith(path.sep)) {
|
||||
p = `${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,
|
||||
crlfDelay: Infinity
|
||||
})
|
||||
for await (const line of rl) {
|
||||
for await (let line of rl) {
|
||||
if (!line.startsWith('#') && line !== '') {
|
||||
if (excludedFiles) {
|
||||
if (line.startsWith('!')) {
|
||||
yield line
|
||||
} else {
|
||||
yield `!${line}`
|
||||
line = line.startsWith('!') ? line : `!${line}`
|
||||
if (line.endsWith(path.sep)) {
|
||||
line = `${line}**`
|
||||
}
|
||||
yield line
|
||||
} else {
|
||||
line = line.endsWith(path.sep) ? `${line}**` : line
|
||||
yield line
|
||||
}
|
||||
}
|
||||
@ -998,6 +999,7 @@ export const getFilePatterns = async ({
|
||||
if (inputs.files) {
|
||||
const filesPatterns = inputs.files
|
||||
.split(inputs.filesSeparator)
|
||||
.map(p => (p.endsWith(path.sep) ? `${p}**` : p))
|
||||
.filter(Boolean)
|
||||
|
||||
cleanedFilePatterns.push(...filesPatterns)
|
||||
@ -1029,8 +1031,9 @@ export const getFilePatterns = async ({
|
||||
.split(inputs.filesIgnoreSeparator)
|
||||
.filter(Boolean)
|
||||
.map(p => {
|
||||
if (!p.startsWith('!')) {
|
||||
p = `!${p}`
|
||||
p = p.startsWith('!') ? p : `!${p}`
|
||||
if (p.endsWith(path.sep)) {
|
||||
p = `${p}**`
|
||||
}
|
||||
return p
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user