Added OP_ENV_FILE to acceptance test, fixed lint/style error and added example .env.tpl documentation in README

Signed-off-by: Willi Carlsen <carlsenwilli@gmail.com>
This commit is contained in:
Willi Carlsen
2025-09-03 08:45:53 +02:00
parent d11f2d1dac
commit 08a0af8ec3
6 changed files with 31 additions and 16 deletions

View File

@@ -2,9 +2,7 @@ import * as core from "@actions/core";
import { validateCli } from "@1password/op-js";
import { installCliOnGithubActionRunner } from "op-cli-installer";
import { loadSecrets, unsetPrevious, validateAuth } from "./utils";
import {
envFilePath,
} from "./constants";
import { envFilePath } from "./constants";
const loadSecretsAction = async () => {
try {
@@ -20,16 +18,16 @@ const loadSecretsAction = async () => {
// Validate that a proper authentication configuration is set for the CLI
validateAuth();
// Download and install the CLI
await installCLI();
// Set environment variables from OP_ENV_FILE
const file = process.env[envFilePath];
if (file) {
core.info(`Loading environment variables from file: ${file}`);
process.loadEnvFile(file)
process.loadEnvFile(file);
}
// Download and install the CLI
await installCLI();
// Load secrets
await loadSecrets(shouldExportEnv);
} catch (error) {