From ceef4055293dda10152c6b95365e6ded2315de20 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Sun, 28 Mar 2021 21:31:14 +0200 Subject: [PATCH] Warning if not tag generated --- dist/index.js | 24 +++++++++++++++++------- src/main.ts | 22 +++++++++++++++------- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5db4164a6..cb43f6895 100644 --- a/dist/index.js +++ b/dist/index.js @@ -259,17 +259,27 @@ function run() { core.endGroup(); const meta = new meta_1.Meta(inputs, context, repo); const version = meta.version; - core.startGroup(`Docker image version`); - core.info(version.main || ''); - core.endGroup(); + if (meta.version.main == undefined || meta.version.main.length == 0) { + core.warning(`No Docker image version has been generated. Check tags input.`); + } + else { + core.startGroup(`Docker image version`); + core.info(version.main || ''); + core.endGroup(); + } core.setOutput('version', version.main || ''); // Docker tags const tags = meta.getTags(); - core.startGroup(`Docker tags`); - for (let tag of tags) { - core.info(tag); + if (tags.length == 0) { + core.warning('No Docker tag has been generated. Check tags input.'); + } + else { + core.startGroup(`Docker tags`); + for (let tag of tags) { + core.info(tag); + } + core.endGroup(); } - core.endGroup(); core.setOutput('tags', tags.join(inputs.sepTags)); // Docker labels const labels = meta.getLabels(); diff --git a/src/main.ts b/src/main.ts index 27611091d..cf0e7ec58 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,18 +29,26 @@ async function run() { const meta: Meta = new Meta(inputs, context, repo); const version: Version = meta.version; - core.startGroup(`Docker image version`); - core.info(version.main || ''); - core.endGroup(); + if (meta.version.main == undefined || meta.version.main.length == 0) { + core.warning(`No Docker image version has been generated. Check tags input.`); + } else { + core.startGroup(`Docker image version`); + core.info(version.main || ''); + core.endGroup(); + } core.setOutput('version', version.main || ''); // Docker tags const tags: Array = meta.getTags(); - core.startGroup(`Docker tags`); - for (let tag of tags) { - core.info(tag); + if (tags.length == 0) { + core.warning('No Docker tag has been generated. Check tags input.'); + } else { + core.startGroup(`Docker tags`); + for (let tag of tags) { + core.info(tag); + } + core.endGroup(); } - core.endGroup(); core.setOutput('tags', tags.join(inputs.sepTags)); // Docker labels