@kakarot-ci/core 0.5.1 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +17 -2
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +17 -2
- package/dist/index.js.map +2 -2
- package/dist/src/utils/config-loader.d.ts.map +1 -1
- package/dist/src/utils/test-target-extractor.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -138,6 +138,12 @@ async function loadConfig() {
|
|
|
138
138
|
if (!config.githubToken && process.env.GITHUB_TOKEN) {
|
|
139
139
|
config.githubToken = process.env.GITHUB_TOKEN;
|
|
140
140
|
}
|
|
141
|
+
if (process.env.PROVIDER) {
|
|
142
|
+
config.provider = process.env.PROVIDER;
|
|
143
|
+
}
|
|
144
|
+
if (process.env.MODEL) {
|
|
145
|
+
config.model = process.env.MODEL;
|
|
146
|
+
}
|
|
141
147
|
return KakarotConfigSchema.parse(config);
|
|
142
148
|
} catch (err) {
|
|
143
149
|
if (err instanceof Error && err.message.includes("apiKey")) {
|
|
@@ -700,15 +706,24 @@ async function analyzeFile(filePath, content, changedRanges, ref, githubClient,
|
|
|
700
706
|
async function extractTestTargets(files, githubClient, prHeadRef, config) {
|
|
701
707
|
info(`Analyzing ${files.length} file(s) for test targets`);
|
|
702
708
|
const diffs = parsePullRequestFiles(files);
|
|
709
|
+
const globToRegex = (pattern) => {
|
|
710
|
+
let regexStr = pattern.replace(/\./g, "\\.");
|
|
711
|
+
regexStr = regexStr.replace(/\*\*\//g, "__DOUBLE_STAR_SLASH__");
|
|
712
|
+
regexStr = regexStr.replace(/\*\*/g, "__DOUBLE_STAR__");
|
|
713
|
+
regexStr = regexStr.replace(/\*/g, "[^/]*");
|
|
714
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR_SLASH__/g, "(.*/)?");
|
|
715
|
+
regexStr = regexStr.replace(/__DOUBLE_STAR__/g, ".*");
|
|
716
|
+
return new RegExp(`^${regexStr}$`);
|
|
717
|
+
};
|
|
703
718
|
const filteredDiffs = diffs.filter((diff) => {
|
|
704
719
|
const matchesInclude = config.includePatterns.some((pattern) => {
|
|
705
|
-
const regex =
|
|
720
|
+
const regex = globToRegex(pattern);
|
|
706
721
|
return regex.test(diff.filename);
|
|
707
722
|
});
|
|
708
723
|
if (!matchesInclude)
|
|
709
724
|
return false;
|
|
710
725
|
const matchesExclude = config.excludePatterns.some((pattern) => {
|
|
711
|
-
const regex =
|
|
726
|
+
const regex = globToRegex(pattern);
|
|
712
727
|
return regex.test(diff.filename);
|
|
713
728
|
});
|
|
714
729
|
return !matchesExclude;
|