@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.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,25 +369,27 @@ var GitHubClient = class {
365
369
  * Check if a file exists in the repository
366
370
  */
367
371
  async fileExists(ref, path) {
368
- return this.withRetry(async () => {
369
- try {
370
- await this.octokit.rest.repos.getContent({
371
- owner: this.owner,
372
- repo: this.repo,
373
- path,
374
- ref
375
- });
376
- return true;
377
- } catch (err) {
378
- if (err && typeof err === "object" && "status" in err && err.status === 404) {
379
- return false;
380
- }
381
- if (err instanceof Error && (err.message.includes("404") || err.message.includes("Not Found"))) {
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")) {
382
388
  return false;
383
389
  }
384
- throw err;
385
390
  }
386
- }, `fileExists(${ref}, ${path})`);
391
+ throw err;
392
+ }
387
393
  }
388
394
  /**
389
395
  * Get the current rate limit status