From 6bbb1022a95661975eaea6edf68e32d4586a4287 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 24 Sep 2021 17:22:41 +0200 Subject: [PATCH] Don't set outputs if empty or nil Signed-off-by: CrazyMax --- dist/index.js | 6 +++++- src/buildx.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index c7b3239..c949d1e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -56,7 +56,11 @@ function getMetadata() { if (!fs_1.default.existsSync(metadataFile)) { return undefined; } - return fs_1.default.readFileSync(metadataFile, { encoding: 'utf-8' }); + const content = fs_1.default.readFileSync(metadataFile, { encoding: 'utf-8' }).trim(); + if (content === 'null') { + return undefined; + } + return content; }); } exports.getMetadata = getMetadata; diff --git a/src/buildx.ts b/src/buildx.ts index 5d4eb3b..e2a0e51 100644 --- a/src/buildx.ts +++ b/src/buildx.ts @@ -14,7 +14,11 @@ export async function getMetadata(): Promise { if (!fs.existsSync(metadataFile)) { return undefined; } - return fs.readFileSync(metadataFile, {encoding: 'utf-8'}); + const content = fs.readFileSync(metadataFile, {encoding: 'utf-8'}).trim(); + if (content === 'null') { + return undefined; + } + return content; } export async function isAvailable(): Promise {