Skip to content

Commit

Permalink
fix: remove GITHUB_URL environment variable as a fallback for the G…
Browse files Browse the repository at this point in the history
…itHub API URL
  • Loading branch information
3w36zj6 committed Jul 23, 2024
1 parent 92d2525 commit 18016ae
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/platforms/github/GitHubAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<typeof GitHubNodeAPI>[0] & { debug: boolean } = {
debug: !!process.env.LOG_FETCH_REQUESTS,
baseUrl: host,
Expand Down Expand Up @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion source/platforms/github/customGitHubRequire.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

Expand Down
2 changes: 1 addition & 1 deletion source/runner/dslGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit 18016ae

Please sign in to comment.