From edd98082e8f3dfb2c288a87c61ca72dd4afa4a3a Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Wed, 29 May 2024 14:26:50 +0200 Subject: [PATCH] don't generate summary for cloud driver Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- src/main.ts | 5 +++++ src/state-helper.ts | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/main.ts b/src/main.ts index 3566af0..b556eb4 100644 --- a/src/main.ts +++ b/src/main.ts @@ -83,6 +83,7 @@ actionsToolkit.run( await core.group(`Builder info`, async () => { const builder = await toolkit.builder.inspect(inputs.builder); core.info(JSON.stringify(builder, null, 2)); + stateHelper.setBuilder(builder); }); const args: string[] = await context.getArgs(inputs, toolkit); @@ -145,6 +146,10 @@ actionsToolkit.run( core.info('Summary disabled'); return; } + if (stateHelper.builder && stateHelper.builder.driver === 'cloud') { + core.info('Summary is not yet supported with Docker Build Cloud'); + return; + } try { const buildxHistory = new BuildxHistory(); const exportRes = await buildxHistory.export({ diff --git a/src/state-helper.ts b/src/state-helper.ts index 04225e7..bc8bde7 100644 --- a/src/state-helper.ts +++ b/src/state-helper.ts @@ -1,9 +1,12 @@ import * as core from '@actions/core'; +import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder'; + import {Inputs, sanitizeInputs} from './context'; export const tmpDir = process.env['STATE_tmpDir'] || ''; export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined; +export const builder = process.env['STATE_builder'] ? JSON.parse(process.env['STATE_builder']) : undefined; export const buildRef = process.env['STATE_buildRef'] || ''; export function setTmpDir(tmpDir: string) { @@ -14,6 +17,10 @@ export function setInputs(inputs: Inputs) { core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs))); } +export function setBuilder(builder: BuilderInfo) { + core.saveState('builder', JSON.stringify(builder)); +} + export function setBuildRef(buildRef: string) { core.saveState('buildRef', buildRef); }