fix: resolve variable scope issues causing CI failures

- Move builder variable declaration to outer scope
- Use optional chaining for builder.name in buildRef call
- Fixes runtime error where builder was undefined outside its declaration scope

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Claude 2025-08-03 17:33:17 -04:00
parent 61dd93325b
commit 805af4fb88
3 changed files with 4 additions and 4 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -92,10 +92,10 @@ actionsToolkit.run(
let buildDurationSeconds: string | undefined;
let ref: string | undefined;
let isBlacksmithBuilder = false;
let builder: BuilderInfo;
try {
// Check that a builder is available (either from setup-docker-builder or existing)
let builder: BuilderInfo;
await core.group(`Checking for configured builder`, async () => {
try {
builder = await toolkit.builder.inspect();
@ -199,7 +199,7 @@ actionsToolkit.run(
}
await core.group(`Reference`, async () => {
ref = await buildRef(toolkit, startedTime, builder.name);
ref = await buildRef(toolkit, startedTime, builder?.name);
if (ref) {
core.info(ref);
stateHelper.setBuildRef(ref);