Skip to content

Commit

Permalink
feat: skip installation of attic when installed
Browse files Browse the repository at this point in the history
Adds a check to skip the installation of `attic` when
`attic -V` returns with exit code 0.
  • Loading branch information
pfzetto committed May 17, 2024
1 parent f75ac4b commit 002cc6e
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 002cc6e

Please sign in to comment.