From 0ff92dd768ca934e09a8b0b66c9c8718f54f37b2 Mon Sep 17 00:00:00 2001 From: Willi Carlsen Date: Sat, 6 Sep 2025 07:37:10 +0200 Subject: [PATCH] Using dotenv package instead of experimental API process.loadEnvFile Signed-off-by: Willi Carlsen --- package-lock.json | 13 +++++++++++++ package.json | 1 + src/index.ts | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 6a1bd95..dabce4d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@1password/op-js": "^0.1.11", "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", + "dotenv": "^17.2.2", "op-cli-installer": "github:1Password/op-cli-installer#e6c1c758bc3339e5fe9b06255728039f688f73fa" }, "devDependencies": { @@ -2766,6 +2767,18 @@ "node": ">=6.0.0" } }, + "node_modules/dotenv": { + "version": "17.2.2", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.2.tgz", + "integrity": "sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", diff --git a/package.json b/package.json index f23ff70..74d973d 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "@1password/op-js": "^0.1.11", "@actions/core": "^1.10.1", "@actions/exec": "^1.1.1", + "dotenv": "^17.2.2", "op-cli-installer": "github:1Password/op-cli-installer#e6c1c758bc3339e5fe9b06255728039f688f73fa" }, "devDependencies": { diff --git a/src/index.ts b/src/index.ts index c63cf94..6469bcd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,6 +1,7 @@ import * as core from "@actions/core"; import { validateCli } from "@1password/op-js"; import { installCliOnGithubActionRunner } from "op-cli-installer"; +import dotenv from "dotenv"; import { loadSecrets, unsetPrevious, validateAuth } from "./utils"; import { envFilePath } from "./constants"; @@ -22,7 +23,7 @@ const loadSecretsAction = async () => { const file = process.env[envFilePath]; if (file) { core.info(`Loading environment variables from file: ${file}`); - process.loadEnvFile(file); + dotenv.config({ path: file }); } // Download and install the CLI