From 66cb6b2c1a84a01f343fe577867b1d2ed049e2f2 Mon Sep 17 00:00:00 2001 From: Zachary Whaley Date: Wed, 17 Jul 2024 15:09:27 -0500 Subject: [PATCH] feat: support GitHub Enterprise (#62) GitHub Actions sets the environment variable GITHUB_API_URL to the API URL of the instance of GitHub. For example, if running on github.com, then GITHUB_API_URL will be https://api.github.com; if running on ghe.my-company.com, then GITHUB_API_URL will be https://ghe.my-company.com/api/v3. By setting the baseUrl of Octokit to the GITHUB_API_URL environment variable, any instance of GitHub Actions is supported, github.com or GitHub Enterprise. --- src/github.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/github.ts b/src/github.ts index 19ddbfc..05b86d4 100644 --- a/src/github.ts +++ b/src/github.ts @@ -7,6 +7,7 @@ export class OctokitGitHub { constructor(githubToken: string) { Octokit.plugin(require("@octokit/plugin-throttling")); this.octokit = new Octokit({ + baseUrl: process.env["GITHUB_API_URL"] || "https://api.github.com", auth: githubToken, throttle: { onRateLimit: (retryAfter, options) => {