@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/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,25 +274,27 @@ var GitHubClient = class {
270
274
  * Check if a file exists in the repository
271
275
  */
272
276
  async fileExists(ref, path) {
273
- return this.withRetry(async () => {
274
- try {
275
- await this.octokit.rest.repos.getContent({
276
- owner: this.owner,
277
- repo: this.repo,
278
- path,
279
- ref
280
- });
281
- return true;
282
- } catch (err) {
283
- if (err && typeof err === "object" && "status" in err && err.status === 404) {
284
- return false;
285
- }
286
- if (err instanceof Error && (err.message.includes("404") || err.message.includes("Not Found"))) {
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")) {
287
293
  return false;
288
294
  }
289
- throw err;
290
295
  }
291
- }, `fileExists(${ref}, ${path})`);
296
+ throw err;
297
+ }
292
298
  }
293
299
  /**
294
300
  * Get the current rate limit status