From 18016ae2ad5b7a43107f5ff0ad49021a84cbbd86 Mon Sep 17 00:00:00 2001 From: 3w36zj6 <52315048+3w36zj6@users.noreply.github.com> Date: Wed, 24 Jul 2024 01:57:13 +0900 Subject: [PATCH] fix: remove `GITHUB_URL` environment variable as a fallback for the GitHub API URL --- source/platforms/github/GitHubAPI.ts | 4 ++-- source/platforms/github/customGitHubRequire.ts | 2 +- source/runner/dslGenerator.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/platforms/github/GitHubAPI.ts b/source/platforms/github/GitHubAPI.ts index 65a9eee6e..6d9ddb782 100644 --- a/source/platforms/github/GitHubAPI.ts +++ b/source/platforms/github/GitHubAPI.ts @@ -52,7 +52,7 @@ export class GitHubAPI { // A token should have been set by this point const token = accessTokenForApp || this.token! - const host = process.env["DANGER_GITHUB_API_BASE_URL"] || process.env["GITHUB_URL"] || undefined + const host = process.env["DANGER_GITHUB_API_BASE_URL"] || "https://api.github.com" const options: ConstructorParameters[0] & { debug: boolean } = { debug: !!process.env.LOG_FETCH_REQUESTS, baseUrl: host, @@ -515,7 +515,7 @@ ${file.patch} } const containsBase = path.startsWith("http") - const baseUrl = process.env["DANGER_GITHUB_API_BASE_URL"] || process.env["GITHUB_URL"] || "https://api.github.com" + const baseUrl = process.env["DANGER_GITHUB_API_BASE_URL"] || "https://api.github.com" const url = containsBase ? path : `${baseUrl}/${path}` let customAccept = {} diff --git a/source/platforms/github/customGitHubRequire.ts b/source/platforms/github/customGitHubRequire.ts index 5f6b4c134..43951e467 100644 --- a/source/platforms/github/customGitHubRequire.ts +++ b/source/platforms/github/customGitHubRequire.ts @@ -61,7 +61,7 @@ export async function getGitHubFileContents( ) { const refString = ref ? `?ref=${ref}` : "" const containsBase = path.startsWith("http") - const baseUrl = process.env["DANGER_GITHUB_API_BASE_URL"] || process.env["GITHUB_URL"] || "https://api.github.com" + const baseUrl = process.env["DANGER_GITHUB_API_BASE_URL"] || "https://api.github.com" const URLPath = `repos/${repoSlug}/contents/${path}${refString}` const url = containsBase ? URLPath : `${baseUrl}/${URLPath}` diff --git a/source/runner/dslGenerator.ts b/source/runner/dslGenerator.ts index c143da40c..ec3d68885 100644 --- a/source/runner/dslGenerator.ts +++ b/source/runner/dslGenerator.ts @@ -39,7 +39,7 @@ export const jsonDSLGenerator = async ( github: { accessToken: process.env["DANGER_GITHUB_API_TOKEN"] || process.env["GITHUB_TOKEN"] || "NO_TOKEN", additionalHeaders: {}, - baseURL: process.env["DANGER_GITHUB_API_BASE_URL"] || process.env["GITHUB_URL"] || undefined, + baseURL: process.env["DANGER_GITHUB_API_BASE_URL"] || "https://api.github.com", }, cliArgs, },