diff --git a/dist/index.js b/dist/index.js index 416f12b4..f746e365 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 5ae2fa44..3604f1a6 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/src/model/exec-with-error-check.ts b/src/model/exec-with-error-check.ts index 3240a07d..4d0c3290 100644 --- a/src/model/exec-with-error-check.ts +++ b/src/model/exec-with-error-check.ts @@ -1,4 +1,5 @@ import { getExecOutput, ExecOptions } from '@actions/exec'; +import { summary } from '@actions/core'; export async function execWithErrorCheck( commandLine: string, @@ -12,18 +13,35 @@ export async function execWithErrorCheck( return result.exitCode; } - // Check for errors in the Build Results section - const match = result.stdout.match(/^#\s*Build results\s*#(.*)^Size:/ms); + // Check for errors in the Unity Build Results section + const unityMatch = result.stdout.match(/^#\s*Build results\s*#(.*)^Size:/ms); - if (match) { - const buildResults = match[1]; + if (unityMatch) { + const buildResults = unityMatch[1]; const errorMatch = buildResults.match(/^Errors:\s*(\d+)$/m); if (errorMatch && Number.parseInt(errorMatch[1], 10) !== 0) { throw new Error(`There was an error building the project. Please read the logs for details.`); } - } else { - throw new Error(`There was an error building the project. Please read the logs for details.`); + await summary.addHeading('Build Results').addQuote(unityMatch[0]).write(); + + return result.exitCode; } - return result.exitCode; + // Check for presence of game-ci message(s) + const gameciMatch = result.stdout.match(/^GAME_CI_BUILD_SUCCESS$/ms); + + if (gameciMatch) { + const quote = + result.stdout + .match(/^GAME_CI_STEP_SUMMARY.*$/gm) + ?.map((x) => x.replace('GAME_CI_STEP_SUMMARY', '')) + .join('\n\n') ?? ''; + await summary.addHeading('Build Results').addQuote(quote).write(); + + return result.exitCode; + } + + throw new Error( + `There was an error building the project. Did not find success messages in logs (either Unity's build results or GAME_CI_BUILD_SUCCESS).`, + ); }