mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-22 10:36:47 +00:00
Added the include
pattern matching feature to the gh action
This commit is contained in:
parent
89a44f2d65
commit
49d90aa697
9 changed files with 73 additions and 22 deletions
22
src/main.ts
22
src/main.ts
|
@ -247,12 +247,26 @@ async function main() {
|
|||
const excludePatterns = core
|
||||
.getInput("exclude")
|
||||
.split(",")
|
||||
.map((s) => s.trim());
|
||||
.map((s) => s.trim())
|
||||
.filter((s) => s.length > 0); // Filter out empty strings;
|
||||
|
||||
const includePatterns = core
|
||||
.getInput("include")
|
||||
.split(",")
|
||||
.map((s) => s.trim())
|
||||
.filter((s) => s.length > 0); // Filter out empty strings;
|
||||
|
||||
const filteredDiff = parsedDiff.filter((file) => {
|
||||
return !excludePatterns.some((pattern) =>
|
||||
minimatch(file.to ?? "", pattern)
|
||||
);
|
||||
const excluded: boolean =
|
||||
excludePatterns.length > 0 &&
|
||||
excludePatterns.some((pattern) => minimatch(file.to ?? "", pattern));
|
||||
|
||||
const included: boolean =
|
||||
includePatterns.length === 0 ||
|
||||
includePatterns.some((pattern) => minimatch(file.to ?? "", pattern));
|
||||
|
||||
// Exluded patterns take precedence over included patterns.
|
||||
return !excluded && included;
|
||||
});
|
||||
|
||||
const comments = await analyzeCode(filteredDiff, prDetails);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue