mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-04-21 01:56: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
35
dist/index.js
vendored
35
dist/index.js
vendored
|
@ -331,15 +331,34 @@ ${chunk.changes
|
|||
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) => {
|
||||
var _a;
|
||||
return (0, minimatch_1.default)(
|
||||
(_a = file.to) !== null && _a !== void 0 ? _a : "",
|
||||
pattern
|
||||
);
|
||||
});
|
||||
const excluded =
|
||||
excludePatterns.length > 0 &&
|
||||
excludePatterns.some((pattern) => {
|
||||
var _a;
|
||||
return (0, minimatch_1.default)(
|
||||
(_a = file.to) !== null && _a !== void 0 ? _a : "",
|
||||
pattern
|
||||
);
|
||||
});
|
||||
const included =
|
||||
includePatterns.length === 0 ||
|
||||
includePatterns.some((pattern) => {
|
||||
var _a;
|
||||
return (0, minimatch_1.default)(
|
||||
(_a = file.to) !== null && _a !== void 0 ? _a : "",
|
||||
pattern
|
||||
);
|
||||
});
|
||||
// Exluded patterns take precedence over included patterns.
|
||||
return !excluded && included;
|
||||
});
|
||||
const comments = yield analyzeCode(filteredDiff, prDetails);
|
||||
if (comments.length > 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue