mirror of
https://github.com/actions/setup-go.git
synced 2024-11-23 23:55:25 +08:00
Revise isGhes
logic (#511)
Some checks failed
Validate 'setup-go' / stable (macos-latest) (push) Waiting to run
Validate 'setup-go' / stable (windows-latest) (push) Waiting to run
Validate 'setup-go' / oldstable (macos-latest) (push) Waiting to run
Validate 'setup-go' / oldstable (windows-latest) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x32, windows-latest, oldstable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x32, windows-latest, stable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, macos-latest, oldstable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, macos-latest, stable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, windows-latest, oldstable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, windows-latest, stable) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.20.14, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.21.10, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.21.10, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.22.3, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.22.3, windows-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.20.14, macos-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.21, macos-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.21, windows-latest) (push) Waiting to run
Validate 'setup-go' / go-version-file (macos-latest) (push) Waiting to run
Validate 'setup-go' / go-version-file (windows-latest) (push) Waiting to run
Validate 'setup-go' / go-version-file-with-gowork (macos-latest) (push) Waiting to run
Basic validation / Basic validation (push) Failing after 0s
Validate 'setup-go' / go-version-file-with-gowork (windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.20.14, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21.10, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21.10, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.22.3, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.22.3, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21, windows-latest) (push) Waiting to run
Validate 'setup-go' / architecture (1.20.14, macos-latest) (push) Waiting to run
Check dist/ / Check dist/ (push) Failing after 0s
Validate 'setup-go' / architecture (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / architecture (1.21, macos-latest) (push) Waiting to run
Validate 'setup-go' / architecture (1.21, windows-latest) (push) Waiting to run
Validate Windows installation / Validate if symlink is created (false, 1.20.1) (push) Waiting to run
Validate Windows installation / Validate if symlink is created (true, 1.20.1) (push) Waiting to run
Validate Windows installation / Find default go version (push) Waiting to run
Validate Windows installation / Validate if symlink is not created for default go (false) (push) Blocked by required conditions
Validate Windows installation / Validate if symlink is not created for default go (true) (push) Blocked by required conditions
Validate Windows installation / Validate if hostedtoolcache works as expected (false, 1.20.1) (push) Waiting to run
Licensed / Licensed (push) Failing after 0s
CodeQL analysis / CodeQL analysis (push) Failing after 2s
Validate 'setup-go' / stable (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / oldstable (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, oldstable) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, stable) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, oldstable) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, stable) (push) Failing after 35s
Validate 'setup-go' / Setup local-cache version (1.20.14, ubuntu-latest) (push) Failing after 37s
Validate 'setup-go' / Setup local-cache version (1.21.10, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup local-cache version (1.22.3, ubuntu-latest) (push) Failing after 15s
Validate 'setup-go' / check-latest (1.20.14, ubuntu-latest) (push) Failing after 36s
Validate 'setup-go' / check-latest (1.21, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / go-version-file (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / go-version-file-with-gowork (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21.10, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.22.3, ubuntu-latest) (push) Failing after 34s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.20.14, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21, ubuntu-latest) (push) Failing after 34s
Validate 'setup-go' / architecture (1.20.14, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / architecture (1.21, ubuntu-latest) (push) Successful in 39m18s
Some checks failed
Validate 'setup-go' / stable (macos-latest) (push) Waiting to run
Validate 'setup-go' / stable (windows-latest) (push) Waiting to run
Validate 'setup-go' / oldstable (macos-latest) (push) Waiting to run
Validate 'setup-go' / oldstable (windows-latest) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x32, windows-latest, oldstable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x32, windows-latest, stable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, macos-latest, oldstable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, macos-latest, stable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, windows-latest, oldstable) (push) Waiting to run
Validate 'setup-go' / aliases-arch (x64, windows-latest, stable) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.20.14, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.21.10, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.21.10, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.22.3, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup local-cache version (1.22.3, windows-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.20.14, macos-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.21, macos-latest) (push) Waiting to run
Validate 'setup-go' / check-latest (1.21, windows-latest) (push) Waiting to run
Validate 'setup-go' / go-version-file (macos-latest) (push) Waiting to run
Validate 'setup-go' / go-version-file (windows-latest) (push) Waiting to run
Validate 'setup-go' / go-version-file-with-gowork (macos-latest) (push) Waiting to run
Basic validation / Basic validation (push) Failing after 0s
Validate 'setup-go' / go-version-file-with-gowork (windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.20.14, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21.10, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21.10, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.22.3, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.22.3, windows-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21, macos-latest) (push) Waiting to run
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21, windows-latest) (push) Waiting to run
Validate 'setup-go' / architecture (1.20.14, macos-latest) (push) Waiting to run
Check dist/ / Check dist/ (push) Failing after 0s
Validate 'setup-go' / architecture (1.20.14, windows-latest) (push) Waiting to run
Validate 'setup-go' / architecture (1.21, macos-latest) (push) Waiting to run
Validate 'setup-go' / architecture (1.21, windows-latest) (push) Waiting to run
Validate Windows installation / Validate if symlink is created (false, 1.20.1) (push) Waiting to run
Validate Windows installation / Validate if symlink is created (true, 1.20.1) (push) Waiting to run
Validate Windows installation / Find default go version (push) Waiting to run
Validate Windows installation / Validate if symlink is not created for default go (false) (push) Blocked by required conditions
Validate Windows installation / Validate if symlink is not created for default go (true) (push) Blocked by required conditions
Validate Windows installation / Validate if hostedtoolcache works as expected (false, 1.20.1) (push) Waiting to run
Licensed / Licensed (push) Failing after 0s
CodeQL analysis / CodeQL analysis (push) Failing after 2s
Validate 'setup-go' / stable (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / oldstable (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, oldstable) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x32, ubuntu-latest, stable) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, oldstable) (push) Failing after 35s
Validate 'setup-go' / aliases-arch (x64, ubuntu-latest, stable) (push) Failing after 35s
Validate 'setup-go' / Setup local-cache version (1.20.14, ubuntu-latest) (push) Failing after 37s
Validate 'setup-go' / Setup local-cache version (1.21.10, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup local-cache version (1.22.3, ubuntu-latest) (push) Failing after 15s
Validate 'setup-go' / check-latest (1.20.14, ubuntu-latest) (push) Failing after 36s
Validate 'setup-go' / check-latest (1.21, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / go-version-file (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / go-version-file-with-gowork (ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21.10, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.22.3, ubuntu-latest) (push) Failing after 34s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.20.14, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / Setup ${{ matrix.go }} ${{ matrix.os }} (1.21, ubuntu-latest) (push) Failing after 34s
Validate 'setup-go' / architecture (1.20.14, ubuntu-latest) (push) Failing after 35s
Validate 'setup-go' / architecture (1.21, ubuntu-latest) (push) Successful in 39m18s
* Revise `isGhes` logic * ran `npm run format` * added unit test * tweaked unit test * ran `npm run format`
This commit is contained in:
parent
d60b41a563
commit
941977282c
@ -209,3 +209,41 @@ describe('isCacheFeatureAvailable', () => {
|
||||
expect(warningSpy).toHaveBeenCalledWith(warningMessage);
|
||||
});
|
||||
});
|
||||
|
||||
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(cacheUtils.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(cacheUtils.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(cacheUtils.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(cacheUtils.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(cacheUtils.isGhes()).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
6
dist/cache-save/index.js
vendored
6
dist/cache-save/index.js
vendored
@ -81175,7 +81175,11 @@ const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0,
|
||||
exports.getCacheDirectoryPath = getCacheDirectoryPath;
|
||||
function isGhes() {
|
||||
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;
|
||||
function isCacheFeatureAvailable() {
|
||||
|
6
dist/setup/index.js
vendored
6
dist/setup/index.js
vendored
@ -88165,7 +88165,11 @@ const getCacheDirectoryPath = (packageManagerInfo) => __awaiter(void 0, void 0,
|
||||
exports.getCacheDirectoryPath = getCacheDirectoryPath;
|
||||
function isGhes() {
|
||||
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;
|
||||
function isCacheFeatureAvailable() {
|
||||
|
@ -63,7 +63,13 @@ export function isGhes(): boolean {
|
||||
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;
|
||||
}
|
||||
|
||||
export function isCacheFeatureAvailable(): boolean {
|
||||
|
Loading…
Reference in New Issue
Block a user