Skip to content

Commit

Permalink
feat: skip installation of attic when installed (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfzetto authored May 25, 2024
1 parent 37f74ba commit 5619ef4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { install } from "./stages/install";
import { install, isInstalled } from "./stages/install";
import { configure } from "./stages/configure";
import { push } from "./stages/push";
import { getState, saveState } from "@actions/core";
import { getState, saveState, info } from "@actions/core";

const isPost = !!getState("isPost");

const main = async () => {
await install();
if (await isInstalled()) {
info("Skipping attic installation because it is already installed");
} else {
await install();
}
await configure();
};

Expand Down
5 changes: 5 additions & 0 deletions src/stages/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ export const install = async () => {

core.endGroup();
};

export const isInstalled = async () => {
let return_code = await exec("attic", ["-V"]);
return return_code === 0;
};

0 comments on commit 5619ef4

Please sign in to comment.