Compare commits
2 Commits
43fd9cdb84
...
e34c300a89
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e34c300a89 | ||
|
|
37a38cf129 |
39368
dist/index.js
vendored
39368
dist/index.js
vendored
File diff suppressed because one or more lines are too long
522
package-lock.json
generated
522
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -39,6 +39,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/1Password/load-secrets-action#readme",
|
"homepage": "https://github.com/1Password/load-secrets-action#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@1password/install-cli-action": "github:1password/install-cli-action#vzt/export-install-function",
|
||||||
"@1password/op-js": "^0.1.11",
|
"@1password/op-js": "^0.1.11",
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1"
|
"@actions/exec": "^1.1.1"
|
||||||
|
|||||||
20
src/index.ts
20
src/index.ts
@@ -1,8 +1,6 @@
|
|||||||
import path from "path";
|
|
||||||
import url from "url";
|
|
||||||
import * as core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import * as exec from "@actions/exec";
|
|
||||||
import { validateCli } from "@1password/op-js";
|
import { validateCli } from "@1password/op-js";
|
||||||
|
import { install } from "@1password/install-cli-action";
|
||||||
import { loadSecrets, unsetPrevious, validateAuth } from "./utils";
|
import { loadSecrets, unsetPrevious, validateAuth } from "./utils";
|
||||||
|
|
||||||
const loadSecretsAction = async () => {
|
const loadSecretsAction = async () => {
|
||||||
@@ -46,21 +44,7 @@ const installCLI = async (): Promise<void> => {
|
|||||||
// If there's no CLI installed, then validateCli will throw an error, which we will use
|
// If there's no CLI installed, then validateCli will throw an error, which we will use
|
||||||
// as an indicator that we need to execute the installation script.
|
// as an indicator that we need to execute the installation script.
|
||||||
await validateCli().catch(async () => {
|
await validateCli().catch(async () => {
|
||||||
const currentFile = url.fileURLToPath(import.meta.url);
|
await install()
|
||||||
const currentDir = path.dirname(currentFile);
|
|
||||||
const parentDir = path.resolve(currentDir, "..");
|
|
||||||
|
|
||||||
// Execute bash script
|
|
||||||
const cmdOut = await exec.getExecOutput(
|
|
||||||
`sh -c "` + parentDir + `/install_cli.sh"`,
|
|
||||||
);
|
|
||||||
|
|
||||||
// Add path to 1Password CLI to $PATH
|
|
||||||
const outArr = cmdOut.stdout.split("\n");
|
|
||||||
if (outArr[0] && process.env.PATH) {
|
|
||||||
const cliPath = outArr[0]?.replace(/^(::debug::OP_INSTALL_DIR: )/, "");
|
|
||||||
core.addPath(cliPath);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user