From 721c0e2a2e07baeca5aa0cf78f7a346142a8b4c1 Mon Sep 17 00:00:00 2001 From: moweilin Date: Thu, 18 Jan 2024 00:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=93=E5=8D=B0env?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/index.js | 6 +++++- package.json | 2 +- src/index.js | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 11a4fe5..2d3e4b5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -26598,14 +26598,18 @@ try { } let content = readFileSync(file, { encoding: "utf-8" }) const envs = process.env + const show = core.getBooleanInput("show") for (const key in envs) { + if(show){ + core.info(`${key}=${envs[key]}`); + } if (key.startsWith("APP_")) { content = content.replace(new RegExp(`\\$\\{\\s*${key}\\s*\\}`), envs[key]); } } writeFileSync(file, content) core.info(`replace envs in ${file}`); - if(core.getBooleanInput("show")){ + if(show){ core.info(`=============\n${content}\n=============`) } } catch (error) { diff --git a/package.json b/package.json index ba75bc5..b09b90b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "action-env-replacer", - "version": "0.0.2", + "version": "0.0.3", "type": "commonjs", "scripts": { "build": "ncc build src/index.js -o dist" diff --git a/src/index.js b/src/index.js index d684eda..bf49b6b 100644 --- a/src/index.js +++ b/src/index.js @@ -10,14 +10,18 @@ try { } let content = readFileSync(file, { encoding: "utf-8" }) const envs = process.env + const show = core.getBooleanInput("show") for (const key in envs) { + if(show){ + core.info(`${key}=${envs[key]}`); + } if (key.startsWith("APP_")) { content = content.replace(new RegExp(`\\$\\{\\s*${key}\\s*\\}`), envs[key]); } } writeFileSync(file, content) core.info(`replace envs in ${file}`); - if(core.getBooleanInput("show")){ + if(show){ core.info(`=============\n${content}\n=============`) } } catch (error) {