mirror of
https://github.com/actions/setup-go.git
synced 2026-04-16 00:45:44 +00:00
skip json for known URL
This commit is contained in:
parent
fa4cd7679b
commit
9142921940
3 changed files with 45 additions and 31 deletions
25
dist/setup/index.js
vendored
25
dist/setup/index.js
vendored
|
|
@ -77063,6 +77063,10 @@ const MANIFEST_REPO_BRANCH = 'main';
|
|||
const MANIFEST_URL = `https://raw.githubusercontent.com/${MANIFEST_REPO_OWNER}/${MANIFEST_REPO_NAME}/${MANIFEST_REPO_BRANCH}/versions-manifest.json`;
|
||||
const DEFAULT_GO_DOWNLOAD_BASE_URL = 'https://go.dev/dl';
|
||||
const GOLANG_DOWNLOAD_URL = 'https://go.dev/dl/?mode=json&include=all';
|
||||
// Base URLs known to not serve a version listing JSON endpoint.
|
||||
// For these URLs we skip the getInfoFromDist() call entirely and construct
|
||||
// the download URL directly, avoiding a guaranteed-404 HTTP request.
|
||||
const NO_VERSION_LISTING_BASE_URLS = ['https://aka.ms/golang/release/latest'];
|
||||
function getGo(versionSpec_1, checkLatest_1, auth_1) {
|
||||
return __awaiter(this, arguments, void 0, function* (versionSpec, checkLatest, auth, arch = os_1.default.arch(), goDownloadBaseUrl) {
|
||||
var _a;
|
||||
|
|
@ -77120,15 +77124,22 @@ function getGo(versionSpec_1, checkLatest_1, auth_1) {
|
|||
//
|
||||
// Download from custom base URL
|
||||
//
|
||||
try {
|
||||
info = yield getInfoFromDist(versionSpec, arch, customBaseUrl);
|
||||
}
|
||||
catch (_b) {
|
||||
core.info('Version listing not available from custom URL. Constructing download URL directly.');
|
||||
}
|
||||
if (!info) {
|
||||
const skipVersionListing = NO_VERSION_LISTING_BASE_URLS.some(url => customBaseUrl.toLowerCase() === url.toLowerCase());
|
||||
if (skipVersionListing) {
|
||||
core.info('Skipping version listing for known direct-download URL. Constructing download URL directly.');
|
||||
info = getInfoFromDirectDownload(versionSpec, arch, customBaseUrl);
|
||||
}
|
||||
else {
|
||||
try {
|
||||
info = yield getInfoFromDist(versionSpec, arch, customBaseUrl);
|
||||
}
|
||||
catch (_b) {
|
||||
core.info('Version listing not available from custom URL. Constructing download URL directly.');
|
||||
}
|
||||
if (!info) {
|
||||
info = getInfoFromDirectDownload(versionSpec, arch, customBaseUrl);
|
||||
}
|
||||
}
|
||||
try {
|
||||
core.info('Install from custom download URL');
|
||||
downloadPath = yield installGoVersion(info, auth, arch, toolCacheName);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue