@kakarot-ci/core 0.6.2 → 0.6.4
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 +30 -16
- package/dist/cli/index.js.map +2 -2
- package/dist/index.cjs +30 -16
- package/dist/index.cjs.map +2 -2
- package/dist/index.js +30 -16
- package/dist/index.js.map +2 -2
- package/dist/src/github/client.d.ts.map +1 -1
- package/dist/src/utils/ast-analyzer.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -245,6 +245,10 @@ var GitHubClient = class {
|
|
|
245
245
|
try {
|
|
246
246
|
return await fn();
|
|
247
247
|
} catch (err) {
|
|
248
|
+
const isNotFound = err && typeof err === "object" && "status" in err && err.status === 404;
|
|
249
|
+
if (isNotFound) {
|
|
250
|
+
throw err;
|
|
251
|
+
}
|
|
248
252
|
if (retries <= 0) {
|
|
249
253
|
error(`${operation} failed after ${this.maxRetries} retries: ${err instanceof Error ? err.message : String(err)}`);
|
|
250
254
|
throw err;
|
|
@@ -431,22 +435,27 @@ var GitHubClient = class {
|
|
|
431
435
|
* Check if a file exists in the repository
|
|
432
436
|
*/
|
|
433
437
|
async fileExists(ref, path) {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
438
|
+
try {
|
|
439
|
+
await this.octokit.rest.repos.getContent({
|
|
440
|
+
owner: this.owner,
|
|
441
|
+
repo: this.repo,
|
|
442
|
+
path,
|
|
443
|
+
ref
|
|
444
|
+
});
|
|
445
|
+
return true;
|
|
446
|
+
} catch (err) {
|
|
447
|
+
const status = err && typeof err === "object" && "status" in err ? err.status : void 0;
|
|
448
|
+
if (status === 404) {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
if (err instanceof Error) {
|
|
452
|
+
const message = err.message.toLowerCase();
|
|
453
|
+
if (message.includes("404") || message.includes("not found")) {
|
|
445
454
|
return false;
|
|
446
455
|
}
|
|
447
|
-
throw err;
|
|
448
456
|
}
|
|
449
|
-
|
|
457
|
+
throw err;
|
|
458
|
+
}
|
|
450
459
|
}
|
|
451
460
|
/**
|
|
452
461
|
* Get the current rate limit status
|
|
@@ -728,9 +737,14 @@ async function detectTestFile(filePath, ref, githubClient, testDirectory) {
|
|
|
728
737
|
...testPatterns.map((pattern) => `__tests__/${baseName}${pattern}`)
|
|
729
738
|
];
|
|
730
739
|
for (const testPath of locations) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
740
|
+
try {
|
|
741
|
+
const exists = await githubClient.fileExists(ref, testPath);
|
|
742
|
+
if (exists) {
|
|
743
|
+
return testPath;
|
|
744
|
+
}
|
|
745
|
+
} catch (err) {
|
|
746
|
+
debug(`Error checking test file ${testPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
747
|
+
continue;
|
|
734
748
|
}
|
|
735
749
|
}
|
|
736
750
|
return void 0;
|