Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove GITHUB_URL environment variable as a fallback for the GitHub API URL #1458

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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