From 8fe07bfb482bbbc395858f850ff00e40c67782f2 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sat, 6 Jan 2024 13:36:16 +0100 Subject: [PATCH] main: check for skopeo only once --- main.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/main.js b/main.js index e81086b..148781a 100644 --- a/main.js +++ b/main.js @@ -17,24 +17,24 @@ function getImageTag(imageName, distribution) { } async function getImageName(distribution) { + const skopeoPath = await io.which('skopeo', false) + if (!skopeoPath) { + core.startGroup("Install skopeo") + await exec.exec("sudo", [ + "apt-get", + "update" + ]) + await exec.exec("sudo", [ + "apt-get", + "-y", + "install", + "skopeo" + ]) + core.endGroup() + } const tag = getImageTag("", distribution) for (const image of ["debian", "ubuntu"]) { try { - const skopeoPath = await io.which('skopeo', true) - if (!skopeoPath) { - core.startGroup("Install skopeo") - await exec.exec("sudo", [ - "apt-get", - "update" - ]) - await exec.exec("sudo", [ - "apt-get", - "-y", - "install", - "skopeo" - ]) - core.endGroup() - } core.startGroup("Get image name") await exec.exec("skopeo", [ "inspect",