From 48b486b7a150bbce602e3b70b29421842041fa05 Mon Sep 17 00:00:00 2001 From: Talia Stocks <928827+taliastocks@users.noreply.github.com> Date: Wed, 16 Apr 2025 10:33:12 -0400 Subject: [PATCH] Fix actions/stale#1227 Fix actions/stale#1227. GitHub Enterprise Server has no rate limits by default, and returns status 404 from the rate_limit endpoint. --- src/classes/issues-processor.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/classes/issues-processor.ts b/src/classes/issues-processor.ts index 486c6a78a..928d9f6c7 100644 --- a/src/classes/issues-processor.ts +++ b/src/classes/issues-processor.ts @@ -645,6 +645,11 @@ export class IssuesProcessor { const rateLimitResult = await this.client.rest.rateLimit.get(); return new RateLimit(rateLimitResult.data.rate); } catch (error) { + if (error.status === 404) { + // Rate limiting is not enabled, due to this being GitHub Enterprise Server + // and not GitHub Cloud. Ignore the error and carry on. + return; + } logger.error(`Error when getting rateLimit: ${error.message}`); } }