@kakarot-ci/core 0.6.3 → 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/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,25 +435,27 @@ var GitHubClient = class {
431
435
  * Check if a file exists in the repository
432
436
  */
433
437
  async fileExists(ref, path) {
434
- return this.withRetry(async () => {
435
- try {
436
- await this.octokit.rest.repos.getContent({
437
- owner: this.owner,
438
- repo: this.repo,
439
- path,
440
- ref
441
- });
442
- return true;
443
- } catch (err) {
444
- if (err && typeof err === "object" && "status" in err && err.status === 404) {
445
- return false;
446
- }
447
- if (err instanceof Error && (err.message.includes("404") || err.message.includes("Not Found"))) {
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")) {
448
454
  return false;
449
455
  }
450
- throw err;
451
456
  }
452
- }, `fileExists(${ref}, ${path})`);
457
+ throw err;
458
+ }
453
459
  }
454
460
  /**
455
461
  * Get the current rate limit status