From 9cd7a4daf650a8b525bf997d92b45460b4098ad8 Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 15:06:19 +0000 Subject: [PATCH 1/9] fix: `STORE_PATH` env issue --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 9b98969..010577a 100644 --- a/action.yml +++ b/action.yml @@ -83,7 +83,7 @@ runs: if: inputs.cache == 'true' shell: bash run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + echo "STORE_PATH=$(pnpm store path --silent | tail -n 1)" >> $GITHUB_ENV - name: Setup pnpm cache if: inputs.cache == 'true' From 36779e98738dbd016f163870ba7c0c4ac3091629 Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 20:37:24 +0200 Subject: [PATCH 2/9] chore: use core package instead of getting inputs manually --- index.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/index.ts b/index.ts index 7759a2b..80e68e2 100644 --- a/index.ts +++ b/index.ts @@ -3,13 +3,12 @@ import * as core from "@actions/core"; import run from "./scripts/init"; try { - const wsdir = process.env.WSDIR || "./"; - const skipDepsInstall: boolean = - process.env.SKIP_DEPS_INSTALL === "true" ? true : false; - const skipBitInstall: boolean = - process.env.SKIP_BIT_INSTALL === "true" ? true : false; + const wsdir = core.getInput("ws-dir") || "./"; + const skipDepsInstall = core.getBooleanInput("skip-deps-install") || false; + const skipBitInstall = core.getBooleanInput("skip-bit-install") || false; + const log = core.getInput("log") || undefined; - const args = process.env.LOG ? [`--log=${process.env.LOG}`] : []; + const args = log ? [`--log=${log}`] : []; if ( !skipDepsInstall && @@ -18,8 +17,8 @@ try { ) { // Keeping backward compatibility for BIT_CONFIG_USER_TOKEN throw new Error("BIT_CONFIG_ACCESS_TOKEN environment variable is not set!"); - } - + } + if (!process.env.BIT_CONFIG_USER_TOKEN) { process.env.BIT_CONFIG_USER_TOKEN = process.env.BIT_CONFIG_ACCESS_TOKEN; } From 58a619b391afb2c17a524e3f444dce89aa7b655d Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 18:40:27 +0000 Subject: [PATCH 3/9] chore: update compiled code --- dist/index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 134a2a3..468ce42 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5835,10 +5835,11 @@ const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const init_1 = __importDefault(__nccwpck_require__(2154)); try { - const wsdir = process.env.WSDIR || "./"; - const skipDepsInstall = process.env.SKIP_DEPS_INSTALL === "true" ? true : false; - const skipBitInstall = process.env.SKIP_BIT_INSTALL === "true" ? true : false; - const args = process.env.LOG ? [`--log=${process.env.LOG}`] : []; + const wsdir = core.getInput("ws-dir") || "./"; + const skipDepsInstall = core.getBooleanInput("skip-deps-install") || false; + const skipBitInstall = core.getBooleanInput("skip-bit-install") || false; + const log = core.getInput("log") || undefined; + const args = log ? [`--log=${log}`] : []; if (!skipDepsInstall && !process.env.BIT_CONFIG_ACCESS_TOKEN && !process.env.BIT_CONFIG_USER_TOKEN) { From afa1f1c55730d45b6a4498b0c2318234402ec41f Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 18:41:47 +0000 Subject: [PATCH 4/9] test: use branch version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 97b3bbf..bd127c1 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Initialize Bit - uses: bit-tasks/init@v3 + uses: bit-tasks/init@cache-issue with: ws-dir: "test-data" # ripple: "true" From 55e77e30056718ece081ff60f2ee0cdd8514e041 Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 18:52:05 +0000 Subject: [PATCH 5/9] fix: use `getInput` instead of validated boolean --- dist/index.js | 4 ++-- index.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 468ce42..1880186 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5836,8 +5836,8 @@ const core = __importStar(__nccwpck_require__(2186)); const init_1 = __importDefault(__nccwpck_require__(2154)); try { const wsdir = core.getInput("ws-dir") || "./"; - const skipDepsInstall = core.getBooleanInput("skip-deps-install") || false; - const skipBitInstall = core.getBooleanInput("skip-bit-install") || false; + const skipDepsInstall = core.getInput("skip-deps-install") === 'true' || false; + const skipBitInstall = core.getInput("skip-bit-install") === 'true' || false; const log = core.getInput("log") || undefined; const args = log ? [`--log=${log}`] : []; if (!skipDepsInstall && diff --git a/index.ts b/index.ts index 80e68e2..3ae92b2 100644 --- a/index.ts +++ b/index.ts @@ -4,8 +4,8 @@ import run from "./scripts/init"; try { const wsdir = core.getInput("ws-dir") || "./"; - const skipDepsInstall = core.getBooleanInput("skip-deps-install") || false; - const skipBitInstall = core.getBooleanInput("skip-bit-install") || false; + const skipDepsInstall = core.getInput("skip-deps-install") === 'true' || false; + const skipBitInstall = core.getInput("skip-bit-install") === 'true'|| false; const log = core.getInput("log") || undefined; const args = log ? [`--log=${log}`] : []; From 7dcc4c87e59fbf613043136cb493c097f7dd1f88 Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 18:57:57 +0000 Subject: [PATCH 6/9] fix: resolve ws.jsonc --- dist/index.js | 4 ++-- scripts/init.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 1880186..51f202c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5938,7 +5938,7 @@ const exec_1 = __nccwpck_require__(1514); const core = __importStar(__nccwpck_require__(2186)); const run = (wsdir, skipDepsInstall, skipBitInstall, args) => __awaiter(void 0, void 0, void 0, function* () { var _a; - const wsDirPath = path.resolve(wsdir); + const wsDirPath = path.join(process.cwd(), wsdir); const wsFile = path.join(wsDirPath, "workspace.jsonc"); const workspaceFileExist = fs.existsSync(wsFile); let bitEngineVersion = ""; @@ -5957,7 +5957,7 @@ const run = (wsdir, skipDepsInstall, skipBitInstall, args) => __awaiter(void 0, } else { // Log a warning if workspace.jsonc is missing - core.warning("WARNING - Cannot find the workspace.jsonc file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!"); + core.warning(`WARNING - Cannot find the workspace.jsonc at ${wsFile} file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!`); } // get installed bit version let installedBitVersion = ""; diff --git a/scripts/init.ts b/scripts/init.ts index e12c18e..5434731 100644 --- a/scripts/init.ts +++ b/scripts/init.ts @@ -10,7 +10,7 @@ const run = async ( skipBitInstall: boolean, args: string[] ) => { - const wsDirPath = path.resolve(wsdir); + const wsDirPath = path.join(process.cwd(), wsdir); const wsFile = path.join(wsDirPath, "workspace.jsonc"); const workspaceFileExist = fs.existsSync(wsFile); let bitEngineVersion = ""; @@ -34,7 +34,7 @@ const run = async ( } else { // Log a warning if workspace.jsonc is missing core.warning( - "WARNING - Cannot find the workspace.jsonc file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!" + `WARNING - Cannot find the workspace.jsonc at ${wsFile} file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!` ); } From 29e1bd2dfec126c7c7c6a5bfc88a6d07a1d384c1 Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 19:02:37 +0000 Subject: [PATCH 7/9] test: debug wsdir --- dist/index.js | 1 + index.ts | 2 ++ 2 files changed, 3 insertions(+) diff --git a/dist/index.js b/dist/index.js index 51f202c..7e47709 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5840,6 +5840,7 @@ try { const skipBitInstall = core.getInput("skip-bit-install") === 'true' || false; const log = core.getInput("log") || undefined; const args = log ? [`--log=${log}`] : []; + core.info(`ws-dir: ${wsdir}`); if (!skipDepsInstall && !process.env.BIT_CONFIG_ACCESS_TOKEN && !process.env.BIT_CONFIG_USER_TOKEN) { diff --git a/index.ts b/index.ts index 3ae92b2..16df458 100644 --- a/index.ts +++ b/index.ts @@ -10,6 +10,8 @@ try { const args = log ? [`--log=${log}`] : []; + core.info(`ws-dir: ${wsdir}`); + if ( !skipDepsInstall && !process.env.BIT_CONFIG_ACCESS_TOKEN && From 3a02edbaed892cef00f811d33026b8c8368e874f Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 19:05:08 +0000 Subject: [PATCH 8/9] revert: input changes --- dist/index.js | 14 ++++++-------- index.ts | 19 +++++++++---------- scripts/init.ts | 6 +++--- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/dist/index.js b/dist/index.js index 7e47709..134a2a3 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5835,12 +5835,10 @@ const fs = __importStar(__nccwpck_require__(7147)); const core = __importStar(__nccwpck_require__(2186)); const init_1 = __importDefault(__nccwpck_require__(2154)); try { - const wsdir = core.getInput("ws-dir") || "./"; - const skipDepsInstall = core.getInput("skip-deps-install") === 'true' || false; - const skipBitInstall = core.getInput("skip-bit-install") === 'true' || false; - const log = core.getInput("log") || undefined; - const args = log ? [`--log=${log}`] : []; - core.info(`ws-dir: ${wsdir}`); + const wsdir = process.env.WSDIR || "./"; + const skipDepsInstall = process.env.SKIP_DEPS_INSTALL === "true" ? true : false; + const skipBitInstall = process.env.SKIP_BIT_INSTALL === "true" ? true : false; + const args = process.env.LOG ? [`--log=${process.env.LOG}`] : []; if (!skipDepsInstall && !process.env.BIT_CONFIG_ACCESS_TOKEN && !process.env.BIT_CONFIG_USER_TOKEN) { @@ -5939,7 +5937,7 @@ const exec_1 = __nccwpck_require__(1514); const core = __importStar(__nccwpck_require__(2186)); const run = (wsdir, skipDepsInstall, skipBitInstall, args) => __awaiter(void 0, void 0, void 0, function* () { var _a; - const wsDirPath = path.join(process.cwd(), wsdir); + const wsDirPath = path.resolve(wsdir); const wsFile = path.join(wsDirPath, "workspace.jsonc"); const workspaceFileExist = fs.existsSync(wsFile); let bitEngineVersion = ""; @@ -5958,7 +5956,7 @@ const run = (wsdir, skipDepsInstall, skipBitInstall, args) => __awaiter(void 0, } else { // Log a warning if workspace.jsonc is missing - core.warning(`WARNING - Cannot find the workspace.jsonc at ${wsFile} file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!`); + core.warning("WARNING - Cannot find the workspace.jsonc file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!"); } // get installed bit version let installedBitVersion = ""; diff --git a/index.ts b/index.ts index 16df458..32d6d88 100644 --- a/index.ts +++ b/index.ts @@ -3,14 +3,13 @@ import * as core from "@actions/core"; import run from "./scripts/init"; try { - const wsdir = core.getInput("ws-dir") || "./"; - const skipDepsInstall = core.getInput("skip-deps-install") === 'true' || false; - const skipBitInstall = core.getInput("skip-bit-install") === 'true'|| false; - const log = core.getInput("log") || undefined; + const wsdir = process.env.WSDIR || "./"; + const skipDepsInstall: boolean = + process.env.SKIP_DEPS_INSTALL === "true" ? true : false; + const skipBitInstall: boolean = + process.env.SKIP_BIT_INSTALL === "true" ? true : false; - const args = log ? [`--log=${log}`] : []; - - core.info(`ws-dir: ${wsdir}`); + const args = process.env.LOG ? [`--log=${process.env.LOG}`] : []; if ( !skipDepsInstall && @@ -19,8 +18,8 @@ try { ) { // Keeping backward compatibility for BIT_CONFIG_USER_TOKEN throw new Error("BIT_CONFIG_ACCESS_TOKEN environment variable is not set!"); - } - + } + if (!process.env.BIT_CONFIG_USER_TOKEN) { process.env.BIT_CONFIG_USER_TOKEN = process.env.BIT_CONFIG_ACCESS_TOKEN; } @@ -120,4 +119,4 @@ try { }); } catch (error: any) { core.setFailed(error.message); -} +} \ No newline at end of file diff --git a/scripts/init.ts b/scripts/init.ts index 5434731..ee13947 100644 --- a/scripts/init.ts +++ b/scripts/init.ts @@ -10,7 +10,7 @@ const run = async ( skipBitInstall: boolean, args: string[] ) => { - const wsDirPath = path.join(process.cwd(), wsdir); + const wsDirPath = path.resolve(wsdir); const wsFile = path.join(wsDirPath, "workspace.jsonc"); const workspaceFileExist = fs.existsSync(wsFile); let bitEngineVersion = ""; @@ -34,7 +34,7 @@ const run = async ( } else { // Log a warning if workspace.jsonc is missing core.warning( - `WARNING - Cannot find the workspace.jsonc at ${wsFile} file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!` + "WARNING - Cannot find the workspace.jsonc file. This will skip initializing ORG and SCOPE environment variables and may affect subsequent tasks!" ); } @@ -95,4 +95,4 @@ const run = async ( } }; -export default run; +export default run; \ No newline at end of file From 906aca778ca3fa21f73487f39805284e5ea4f6fc Mon Sep 17 00:00:00 2001 From: Nacho Aldama Date: Mon, 9 Jun 2025 19:09:56 +0000 Subject: [PATCH 9/9] revert: action version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bd127c1..97b3bbf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Initialize Bit - uses: bit-tasks/init@cache-issue + uses: bit-tasks/init@v3 with: ws-dir: "test-data" # ripple: "true"