FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Account for versioning of ghe.com by rneatherway · Pull Request #1597 · github/codeql-action · GitHub

Account for versioning of ghe.com - #1597

Merged
rneatherway merged 1 commit into
mainfrom
rneatherway/ghe-dotcom
Mar 22, 2023
Merged

rneatherway merged 1 commit into
mainfrom
rneatherway/ghe-dotcom

Conversation

Copy link
Copy Markdown
Contributor

Merge / deployment checklist

  • Confirm this change is backwards compatible with existing workflows.
  • Confirm the readme has been updated if necessary.
  • Confirm the changelog has been updated if necessary.

rneatherway requested a review from a team as a code owner March 21, 2023 17:32

angelapwen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You may want to also add this variant to the tests in

codeql-action/src/util.ts

Lines 304 to 339 in 760583e

export enum GitHubVariant {
DOTCOM,
GHES,
GHAE,
}
export type GitHubVersion =
| { type: GitHubVariant.DOTCOM }
| { type: GitHubVariant.GHAE }
| { type: GitHubVariant.GHES; version: string };
export async function getGitHubVersion(
apiDetails: GitHubApiDetails
): Promise<GitHubVersion> {
// We can avoid making an API request in the standard dotcom case
if (parseGitHubUrl(apiDetails.url) === GITHUB_DOTCOM_URL) {
return { type: GitHubVariant.DOTCOM };
}
// Doesn't strictly have to be the meta endpoint as we're only
// using the response headers which are available on every request.
const apiClient = getApiClient();
const response = await apiClient.meta.get();
// This happens on dotcom, although we expect to have already returned in that
// case. This can also serve as a fallback in cases we haven't foreseen.
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === undefined) {
return { type: GitHubVariant.DOTCOM };
}
if (response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] === "GitHub AE") {
return { type: GitHubVariant.GHAE };
}
const version = response.headers[GITHUB_ENTERPRISE_VERSION_HEADER] as string;
return { type: GitHubVariant.GHES, version };
}
😄

rneatherway force-pushed the rneatherway/ghe-dotcom branch from a9af051 to 3ca2260 Compare March 22, 2023 16:47

Copy link
Copy Markdown
Contributor Author

You may want to also add this variant to the tests in

Thanks, test added!

angelapwen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Just realized I linked the non-test file 😆 but you understood what I meant!

rneatherway enabled auto-merge March 22, 2023 17:02
rneatherway merged commit aefd989 into main Mar 22, 2023
rneatherway deleted the rneatherway/ghe-dotcom branch March 22, 2023 17:21
github-actions Bot mentioned this pull request Mar 22, 2023
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL