Group verbose Go installation logs and normalize package.json line endings (#789)

* refactor: enhance logging and group setup for Go version installation

* refactor: update logging group name for Go version setup

* refactor: standardize formatting in package.json

* audit fix

* update package-lock.json
pull/336/head
Priya Gupta 3 days ago committed by GitHub
parent fba3fb4ead
commit addc0880c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -100576,32 +100576,38 @@ async function run() {
const versionSpec = resolveVersionInput(); const versionSpec = resolveVersionInput();
setGoToolchain(); setGoToolchain();
const cache = getBooleanInput('cache'); const cache = getBooleanInput('cache');
core_info(`Setup go version spec ${versionSpec}`);
let arch = getInput('architecture'); let arch = getInput('architecture');
if (!arch) { if (!arch) {
arch = external_os_default().arch(); arch = external_os_default().arch();
} }
if (versionSpec) { if (versionSpec) {
const token = getInput('token'); startGroup('Installed version');
const auth = !token ? undefined : `token ${token}`; try {
const checkLatest = getBooleanInput('check-latest'); core_info(`Setup go version spec ${versionSpec}`);
const goDownloadBaseUrl = getInput('go-download-base-url') || const token = getInput('token');
process.env['GO_DOWNLOAD_BASE_URL'] || const auth = !token ? undefined : `token ${token}`;
undefined; const checkLatest = getBooleanInput('check-latest');
if (goDownloadBaseUrl) { const goDownloadBaseUrl = getInput('go-download-base-url') ||
core_info(`Using custom Go download base URL: ${goDownloadBaseUrl}`); process.env['GO_DOWNLOAD_BASE_URL'] ||
} undefined;
const installDir = await getGo(versionSpec, checkLatest, auth, arch, goDownloadBaseUrl); if (goDownloadBaseUrl) {
const installDirVersion = external_path_default().basename(external_path_default().dirname(installDir)); core_info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
addPath(external_path_default().join(installDir, 'bin')); }
core_info('Added go to the path'); const installDir = await getGo(versionSpec, checkLatest, auth, arch, goDownloadBaseUrl);
const version = makeSemver(installDirVersion); const installDirVersion = external_path_default().basename(external_path_default().dirname(installDir));
// Go versions less than 1.9 require GOROOT to be set addPath(external_path_default().join(installDir, 'bin'));
if (node_modules_semver.lt(version, '1.9.0')) { core_info('Added go to the path');
core_info('Setting GOROOT for Go version < 1.9'); const version = makeSemver(installDirVersion);
exportVariable('GOROOT', installDir); // Go versions less than 1.9 require GOROOT to be set
} if (node_modules_semver.lt(version, '1.9.0')) {
core_info(`Successfully set up Go version ${versionSpec}`); core_info('Setting GOROOT for Go version < 1.9');
exportVariable('GOROOT', installDir);
}
core_info(`Successfully set up Go version ${versionSpec}`);
}
finally {
endGroup();
}
} }
else { else {
core_info('[warning]go-version input was not specified. The action will try to use pre-installed version.'); core_info('[warning]go-version input was not specified. The action will try to use pre-installed version.');

46
package-lock.json generated

@ -2703,9 +2703,9 @@
} }
}, },
"node_modules/baseline-browser-mapping": { "node_modules/baseline-browser-mapping": {
"version": "2.10.38", "version": "2.11.20",
"resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.38.tgz", "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.20.tgz",
"integrity": "sha512-31/02mVB4yuQU6adKk5SlY6m+mxDwUq5KZkyYgnLrrKl7TEm1+3PyDtDBz2kOv/wxZz41GHsvV1A/u6RmiyBvw==", "integrity": "sha512-H0ulySigv6icDJ1F7SjtdCD6PrhTpdYCmP0CactWy1+ekh0AFd0o1Wn5T8b+hnTmdBx19u9yhL6wvCylXMY7zw==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"bin": { "bin": {
@ -2728,9 +2728,9 @@
} }
}, },
"node_modules/browserslist": { "node_modules/browserslist": {
"version": "4.28.2", "version": "4.28.8",
"resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.8.tgz",
"integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==", "integrity": "sha512-V2NpofLblG64mfOtSgDhOJESZEGogzDMBv/q+W6oc4LXWP/q75eOXoOaaOu1EOadB9U4Bwx/e0yzbvwKH8zalA==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -2748,11 +2748,11 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"baseline-browser-mapping": "^2.10.12", "baseline-browser-mapping": "^2.11.12",
"caniuse-lite": "^1.0.30001782", "caniuse-lite": "^1.0.30001809",
"electron-to-chromium": "^1.5.328", "electron-to-chromium": "^1.5.402",
"node-releases": "^2.0.36", "node-releases": "^2.0.53",
"update-browserslist-db": "^1.2.3" "update-browserslist-db": "^1.3.0"
}, },
"bin": { "bin": {
"browserslist": "cli.js" "browserslist": "cli.js"
@ -2812,9 +2812,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001799", "version": "1.0.30001810",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001799.tgz", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001810.tgz",
"integrity": "sha512-hG1bReV+OUU+MOqK4t/ZWI0tZOyz3rqS9XuhOUz1cIcbwBKjOyJEJuw9ER5JuNyqxNk8u/JUVbGibBOL1yrjFw==", "integrity": "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@ -3093,9 +3093,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/electron-to-chromium": { "node_modules/electron-to-chromium": {
"version": "1.5.376", "version": "1.5.418",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.376.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.418.tgz",
"integrity": "sha512-cUVA7/RvbFTEuw/i3obUwDTRIXojaxkResf+ibByPFxjc6XK3VNtcQXV0NSbAlJ0FMjcJGgftVVB4Qo184EXvA==", "integrity": "sha512-UzS26r3AEbG5wSoGVpJKqwHIU9zwQN7LHdVIThDrJpS0I5KdlXFMEb8543fhc9dVnIIAST6ar8rhwa00AL5MlA==",
"dev": true, "dev": true,
"license": "ISC" "license": "ISC"
}, },
@ -5116,9 +5116,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/node-releases": { "node_modules/node-releases": {
"version": "2.0.48", "version": "2.0.54",
"resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.48.tgz", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.54.tgz",
"integrity": "sha512-1uz8041X6LoI6ZSdZacM9lVY28vuzDlSKitnpbSNK0RfKoIJkX29NBPVEFXhnuSuEOA9Ww0xnPJ+ILWbGAv8DA==", "integrity": "sha512-YHs7BmmcsdAI5Ozuf8JZo6PT0mv2GIWC9vMfvUC3dp65M8hn7Ux8CPL+2oBI7juNuj9d0ndhTcznq2ODBps9cQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@ -6239,9 +6239,9 @@
} }
}, },
"node_modules/update-browserslist-db": { "node_modules/update-browserslist-db": {
"version": "1.2.3", "version": "1.3.2",
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.2.tgz",
"integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "integrity": "sha512-UQ+MSxlhRm1bzjhU+DcuXfjFO1FzNtqhK5+9Yvlp90ItDLk5vT932A0rFu619nf7RVS+Y/VeaUW1jaRDqZ8VJw==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {

@ -21,7 +21,6 @@ export async function run() {
setGoToolchain(); setGoToolchain();
const cache = core.getBooleanInput('cache'); const cache = core.getBooleanInput('cache');
core.info(`Setup go version spec ${versionSpec}`);
let arch = core.getInput('architecture') as Architecture; let arch = core.getInput('architecture') as Architecture;
@ -30,41 +29,48 @@ export async function run() {
} }
if (versionSpec) { if (versionSpec) {
const token = core.getInput('token'); core.startGroup('Installed version');
const auth = !token ? undefined : `token ${token}`; try {
core.info(`Setup go version spec ${versionSpec}`);
const checkLatest = core.getBooleanInput('check-latest'); const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`;
const goDownloadBaseUrl = const checkLatest = core.getBooleanInput('check-latest');
core.getInput('go-download-base-url') ||
process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
if (goDownloadBaseUrl) { const goDownloadBaseUrl =
core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`); core.getInput('go-download-base-url') ||
} process.env['GO_DOWNLOAD_BASE_URL'] ||
undefined;
const installDir = await installer.getGo( if (goDownloadBaseUrl) {
versionSpec, core.info(`Using custom Go download base URL: ${goDownloadBaseUrl}`);
checkLatest, }
auth,
arch,
goDownloadBaseUrl
);
const installDirVersion = path.basename(path.dirname(installDir)); const installDir = await installer.getGo(
versionSpec,
checkLatest,
auth,
arch,
goDownloadBaseUrl
);
core.addPath(path.join(installDir, 'bin')); const installDirVersion = path.basename(path.dirname(installDir));
core.info('Added go to the path');
const version = installer.makeSemver(installDirVersion); core.addPath(path.join(installDir, 'bin'));
// Go versions less than 1.9 require GOROOT to be set core.info('Added go to the path');
if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9'); const version = installer.makeSemver(installDirVersion);
core.exportVariable('GOROOT', installDir); // Go versions less than 1.9 require GOROOT to be set
} if (semver.lt(version, '1.9.0')) {
core.info('Setting GOROOT for Go version < 1.9');
core.exportVariable('GOROOT', installDir);
}
core.info(`Successfully set up Go version ${versionSpec}`); core.info(`Successfully set up Go version ${versionSpec}`);
} finally {
core.endGroup();
}
} else { } else {
core.info( core.info(
'[warning]go-version input was not specified. The action will try to use pre-installed version.' '[warning]go-version input was not specified. The action will try to use pre-installed version.'

Loading…
Cancel
Save