Skip to content

Commit

Permalink
Merge pull request #1458 from 3w36zj6/issue-1374
Browse files Browse the repository at this point in the history
fix: remove `GITHUB_URL` environment variable as a fallback for the GitHub API URL
  • Loading branch information
orta authored Aug 6, 2024
2 parents 92d2525 + 18016ae commit b67d710
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 b67d710

Please sign in to comment.