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 f0fe379
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { install } from "./stages/install";
import { install, is_installed } 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();
await configure();
if(await is_installed()){
info("Skipping attic installation because it is already installed");
}else{
await install();
}
await configure();
};

if (!isPost) {
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 is_installed = async () => {
let return_code = await exec("attic", ["-V"]);
return return_code==0;
};

0 comments on commit f0fe379

Please sign in to comment.