Compare commits

...

4 Commits

Author SHA1 Message Date
dependabot[bot] 5b7c52f033
Merge 4991f0593e into 9c76e71650 2024-10-21 20:39:16 +00:00
aparnajyothi-y 9c76e71650
Bump pillow from 7.2 to 10.2.0 in /__tests__/data (#956)
* Update e2e-cache.yml

* Update basic-validation.yml

* Pyinstaller upgrade to 5.13.1

* pyinstaller-update

* Update basic-validation.yml

* Update e2e-cache.yml

* fix-db-alert-164-165-166

* upgrade pillow
2024-10-21 15:39:11 -05:00
John Wesley Walker III f4c5a1183d
Revise `isGhes` logic (#963)
* Revise `isGhes` logic

* ran `npm run format`

* add unit test

* ran `npm run format`
2024-10-21 11:42:17 -05:00
dependabot[bot] 4991f0593e
Bump urllib3 from 1.25.9 to 1.26.19 in /__tests__/data
Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.25.9 to 1.26.19.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/1.26.19/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.25.9...1.26.19)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-09 03:41:12 +00:00
5 changed files with 54 additions and 5 deletions

View File

@ -8,5 +8,5 @@ packaging==20.7
pdf2image==1.12.1 pdf2image==1.12.1
Pygments==2.6.1 Pygments==2.6.1
requests==2.24.0 requests==2.24.0
urllib3==1.25.10 urllib3==1.26.19
xlrd==1.2.0 xlrd==1.2.0

View File

@ -30,7 +30,7 @@ pdf2image==1.12.1
pefile==2021.9.3; python_full_version >= '3.6.0' pefile==2021.9.3; python_full_version >= '3.6.0'
pillow==7.2 pillow>=10.2.0
pygments==2.6.1 pygments==2.6.1
@ -42,6 +42,6 @@ pywin32-ctypes==0.2.0
requests==2.24.0 requests==2.24.0
urllib3==1.25.9 urllib3==1.26.19
xlrd==1.2.0 xlrd==1.2.0

View File

@ -13,6 +13,7 @@ import {
getVersionInputFromPlainFile, getVersionInputFromPlainFile,
getVersionInputFromTomlFile, getVersionInputFromTomlFile,
getNextPageUrl, getNextPageUrl,
isGhes,
IS_WINDOWS, IS_WINDOWS,
getDownloadFileName getDownloadFileName
} from '../src/utils'; } from '../src/utils';
@ -195,3 +196,41 @@ describe('getDownloadFileName', () => {
} }
}); });
}); });
describe('isGhes', () => {
const pristineEnv = process.env;
beforeEach(() => {
jest.resetModules();
process.env = {...pristineEnv};
});
afterAll(() => {
process.env = pristineEnv;
});
it('returns false when the GITHUB_SERVER_URL environment variable is not defined', async () => {
delete process.env['GITHUB_SERVER_URL'];
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to github.com', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://github.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable is set to a GitHub Enterprise Cloud-style URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://contoso.ghe.com';
expect(isGhes()).toBeFalsy();
});
it('returns false when the GITHUB_SERVER_URL environment variable has a .localhost suffix', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://mock-github.localhost';
expect(isGhes()).toBeFalsy();
});
it('returns true when the GITHUB_SERVER_URL environment variable is set to some other URL', async () => {
process.env['GITHUB_SERVER_URL'] = 'https://src.onpremise.fabrikam.com';
expect(isGhes()).toBeTruthy();
});
});

6
dist/setup/index.js vendored
View File

@ -92017,7 +92017,11 @@ function validatePythonVersionFormatForPyPy(version) {
exports.validatePythonVersionFormatForPyPy = validatePythonVersionFormatForPyPy; exports.validatePythonVersionFormatForPyPy = validatePythonVersionFormatForPyPy;
function isGhes() { function isGhes() {
const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com'); const ghUrl = new URL(process.env['GITHUB_SERVER_URL'] || 'https://github.com');
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM'; const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
} }
exports.isGhes = isGhes; exports.isGhes = isGhes;
function isCacheFeatureAvailable() { function isCacheFeatureAvailable() {

View File

@ -116,7 +116,13 @@ export function isGhes(): boolean {
const ghUrl = new URL( const ghUrl = new URL(
process.env['GITHUB_SERVER_URL'] || 'https://github.com' process.env['GITHUB_SERVER_URL'] || 'https://github.com'
); );
return ghUrl.hostname.toUpperCase() !== 'GITHUB.COM';
const hostname = ghUrl.hostname.trimEnd().toUpperCase();
const isGitHubHost = hostname === 'GITHUB.COM';
const isGitHubEnterpriseCloudHost = hostname.endsWith('.GHE.COM');
const isLocalHost = hostname.endsWith('.LOCALHOST');
return !isGitHubHost && !isGitHubEnterpriseCloudHost && !isLocalHost;
} }
export function isCacheFeatureAvailable(): boolean { export function isCacheFeatureAvailable(): boolean {