@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.js
CHANGED
|
@@ -179,6 +179,10 @@ var GitHubClient = class {
|
|
|
179
179
|
try {
|
|
180
180
|
return await fn();
|
|
181
181
|
} catch (err) {
|
|
182
|
+
const isNotFound = err && typeof err === "object" && "status" in err && err.status === 404;
|
|
183
|
+
if (isNotFound) {
|
|
184
|
+
throw err;
|
|
185
|
+
}
|
|
182
186
|
if (retries <= 0) {
|
|
183
187
|
error(`${operation} failed after ${this.maxRetries} retries: ${err instanceof Error ? err.message : String(err)}`);
|
|
184
188
|
throw err;
|
|
@@ -365,22 +369,27 @@ var GitHubClient = class {
|
|
|
365
369
|
* Check if a file exists in the repository
|
|
366
370
|
*/
|
|
367
371
|
async fileExists(ref, path) {
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
372
|
+
try {
|
|
373
|
+
await this.octokit.rest.repos.getContent({
|
|
374
|
+
owner: this.owner,
|
|
375
|
+
repo: this.repo,
|
|
376
|
+
path,
|
|
377
|
+
ref
|
|
378
|
+
});
|
|
379
|
+
return true;
|
|
380
|
+
} catch (err) {
|
|
381
|
+
const status = err && typeof err === "object" && "status" in err ? err.status : void 0;
|
|
382
|
+
if (status === 404) {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
if (err instanceof Error) {
|
|
386
|
+
const message = err.message.toLowerCase();
|
|
387
|
+
if (message.includes("404") || message.includes("not found")) {
|
|
379
388
|
return false;
|
|
380
389
|
}
|
|
381
|
-
throw err;
|
|
382
390
|
}
|
|
383
|
-
|
|
391
|
+
throw err;
|
|
392
|
+
}
|
|
384
393
|
}
|
|
385
394
|
/**
|
|
386
395
|
* Get the current rate limit status
|
|
@@ -662,9 +671,14 @@ async function detectTestFile(filePath, ref, githubClient, testDirectory) {
|
|
|
662
671
|
...testPatterns.map((pattern) => `__tests__/${baseName}${pattern}`)
|
|
663
672
|
];
|
|
664
673
|
for (const testPath of locations) {
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
674
|
+
try {
|
|
675
|
+
const exists = await githubClient.fileExists(ref, testPath);
|
|
676
|
+
if (exists) {
|
|
677
|
+
return testPath;
|
|
678
|
+
}
|
|
679
|
+
} catch (err) {
|
|
680
|
+
debug(`Error checking test file ${testPath}: ${err instanceof Error ? err.message : String(err)}`);
|
|
681
|
+
continue;
|
|
668
682
|
}
|
|
669
683
|
}
|
|
670
684
|
return void 0;
|