@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/cli/index.js
CHANGED
|
@@ -84,6 +84,10 @@ var GitHubClient = class {
|
|
|
84
84
|
try {
|
|
85
85
|
return await fn();
|
|
86
86
|
} catch (err) {
|
|
87
|
+
const isNotFound = err && typeof err === "object" && "status" in err && err.status === 404;
|
|
88
|
+
if (isNotFound) {
|
|
89
|
+
throw err;
|
|
90
|
+
}
|
|
87
91
|
if (retries <= 0) {
|
|
88
92
|
error(`${operation} failed after ${this.maxRetries} retries: ${err instanceof Error ? err.message : String(err)}`);
|
|
89
93
|
throw err;
|
|
@@ -270,22 +274,27 @@ var GitHubClient = class {
|
|
|
270
274
|
* Check if a file exists in the repository
|
|
271
275
|
*/
|
|
272
276
|
async fileExists(ref, path) {
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
277
|
+
try {
|
|
278
|
+
await this.octokit.rest.repos.getContent({
|
|
279
|
+
owner: this.owner,
|
|
280
|
+
repo: this.repo,
|
|
281
|
+
path,
|
|
282
|
+
ref
|
|
283
|
+
});
|
|
284
|
+
return true;
|
|
285
|
+
} catch (err) {
|
|
286
|
+
const status = err && typeof err === "object" && "status" in err ? err.status : void 0;
|
|
287
|
+
if (status === 404) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
if (err instanceof Error) {
|
|
291
|
+
const message = err.message.toLowerCase();
|
|
292
|
+
if (message.includes("404") || message.includes("not found")) {
|
|
284
293
|
return false;
|
|
285
294
|
}
|
|
286
|
-
throw err;
|
|
287
295
|
}
|
|
288
|
-
|
|
296
|
+
throw err;
|
|
297
|
+
}
|
|
289
298
|
}
|
|
290
299
|
/**
|
|
291
300
|
* Get the current rate limit status
|
|
@@ -672,9 +681,14 @@ async function detectTestFile(filePath, ref, githubClient, testDirectory) {
|
|
|
672
681
|
...testPatterns.map((pattern) => `__tests__/${baseName}${pattern}`)
|
|
673
682
|
];
|
|
674
683
|
for (const testPath of locations) {
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
684
|
+
try {
|
|
685
|
+
const exists = await githubClient.fileExists(ref, testPath);
|
|
686
|
+
if (exists) {
|
|
687
|
+
return testPath;
|
|
688
|
+
}
|
|
689
|
+
} catch (err) {
|
|
690
|
+
debug(`Error checking test file ${testPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
691
|
+
continue;
|
|
678
692
|
}
|
|
679
693
|
}
|
|
680
694
|
return void 0;
|