feature: enable loading 1password secrets from file
Signed-off-by: Willi Carlsen <carlsenwilli@gmail.com>
This commit is contained in:
10
src/index.ts
10
src/index.ts
@@ -2,6 +2,9 @@ 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";
|
||||
|
||||
const loadSecretsAction = async () => {
|
||||
try {
|
||||
@@ -20,6 +23,13 @@ const loadSecretsAction = async () => {
|
||||
// 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)
|
||||
}
|
||||
|
||||
// Load secrets
|
||||
await loadSecrets(shouldExportEnv);
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user