From ea1f75da7fac404bdca1eeb0a31bdfc5769451bc Mon Sep 17 00:00:00 2001 From: Chet Husk Date: Mon, 21 Sep 2026 16:19:59 -0500 Subject: [PATCH] Add info-level logging for MSBuild path, version, and architecture (#79) Upgrades key diagnostics from core.debug to core.info so they are visible by default (not just with ACTIONS_STEP_DEBUG), matching the request in #79: - Log the resolved MSBuild path - Log the resolved MSBuild version (via MSBuild.exe -version -nologo, wrapped in try/catch so a failure to obtain it doesn't fail the action) - Log the architecture used Other existing debug logs are left unchanged. Rebuilt dist/ via npm run build && npm run pack. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- dist/index.js | 19 ++++++++++++++++++- src/main.ts | 20 +++++++++++++++++++- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 36f05ee..af3aeb0 100644 --- a/dist/index.js +++ b/dist/index.js @@ -114,13 +114,30 @@ function run() { core.setFailed('Unable to find MSBuild.'); return; } + core.info(`Found MSBuild tool path: ${foundToolPath}`); + core.info(`Using MSBuild architecture: ${MSBUILD_ARCH}`); + // try to get the MSBuild version for diagnostic purposes; a failure here shouldn't fail the action + try { + let msbuildVersion = ''; + const versionOptions = {}; + versionOptions.listeners = { + stdout: (data) => { + msbuildVersion += data.toString(); + } + }; + yield exec.exec(`"${foundToolPath}" -version -nologo`, [], versionOptions); + core.info(`Found MSBuild version: ${msbuildVersion.trim()}`); + } + catch (error) { + core.debug(`Unable to determine MSBuild version: ${error.message}`); + } // extract the folder location for the tool const toolFolderPath = path.dirname(foundToolPath); // set the outputs for the action to the folder path of msbuild core.setOutput('msbuildPath', toolFolderPath); // add tool path to PATH core.addPath(toolFolderPath); - core.debug(`Tool path added to PATH: ${toolFolderPath}`); + core.info(`Tool path added to PATH: ${toolFolderPath}`); } catch (error) { core.setFailed(error.message); diff --git a/src/main.ts b/src/main.ts index b449dc3..f0a7d8d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -118,6 +118,24 @@ async function run(): Promise { return } + core.info(`Found MSBuild tool path: ${foundToolPath}`) + core.info(`Using MSBuild architecture: ${MSBUILD_ARCH}`) + + // try to get the MSBuild version for diagnostic purposes; a failure here shouldn't fail the action + try { + let msbuildVersion = '' + const versionOptions: ExecOptions = {} + versionOptions.listeners = { + stdout: (data: Buffer) => { + msbuildVersion += data.toString() + } + } + await exec.exec(`"${foundToolPath}" -version -nologo`, [], versionOptions) + core.info(`Found MSBuild version: ${msbuildVersion.trim()}`) + } catch (error) { + core.debug(`Unable to determine MSBuild version: ${error.message}`) + } + // extract the folder location for the tool const toolFolderPath = path.dirname(foundToolPath) @@ -126,7 +144,7 @@ async function run(): Promise { // add tool path to PATH core.addPath(toolFolderPath) - core.debug(`Tool path added to PATH: ${toolFolderPath}`) + core.info(`Tool path added to PATH: ${toolFolderPath}`) } catch (error) { core.setFailed(error.message) }