Skip to content

Commit

Permalink
feat(action): install sqlite3 on macOS if missing
Browse files Browse the repository at this point in the history
  • Loading branch information
deemp committed Mar 30, 2024
1 parent 02c58d1 commit a28395d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/restoreImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from "./stateProvider";
import * as utils from "./utils/action";
import * as restore from "./utils/restore";
import * as install from "./utils/install";

export async function restoreImpl(
stateProvider: IStateProvider
Expand All @@ -33,6 +34,8 @@ export async function restoreImpl(
);
}

await install.installSQLite3();

let restoredKey: string | undefined;
let lookedUpKey: string | undefined;
const restoredKeys: string[] = [];
Expand Down
14 changes: 14 additions & 0 deletions src/utils/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { which } from "which";
import * as inputs from "../inputs";
import { exec } from "@actions/exec";
import * as utils from "./action";

export async function installSQLite3() {
if (inputs.nix) {
const existsSqlite3 = await which("sqlite3");
if (!existsSqlite3) {
utils.info("No SQLite 3 found. Installing it.");
exec(`brew install sqlite3`);
}
}
}

0 comments on commit a28395d

Please sign in to comment.