This commit is contained in:
Michael Lahr 2024-03-14 11:10:00 +08:00
commit 5b828ee105

View file

@ -226,7 +226,15 @@ async function main() {
.split(",") .split(",")
.map((s) => s.trim()); .map((s) => s.trim());
const filteredDiff = parsedDiff.filter((file) => { const includePatterns = core
.getInput("include")
.split(",")
.map((s) => s.trim());
if (includePatterns.length === 0) {
includePatterns.push("*")
}
let filteredDiff = parsedDiff.filter((file) => {
return !excludePatterns.some((pattern) => { return !excludePatterns.some((pattern) => {
let isMatch = minimatch(file.to ?? "", pattern); let isMatch = minimatch(file.to ?? "", pattern);
console.error(file + "," + file.to + "," + pattern + ": " + isMatch) console.error(file + "," + file.to + "," + pattern + ": " + isMatch)
@ -234,6 +242,13 @@ async function main() {
} }
); );
}); });
filteredDiff = filteredDiff.filter((file) => {
return includePatterns.some((pattern) => {
let isMatch = minimatch(file.to ?? "", pattern);
return isMatch
}
);
});
const comments = await analyzeCode(filteredDiff, prDetails); const comments = await analyzeCode(filteredDiff, prDetails);
if (comments.length > 0) { if (comments.length > 0) {