feat: skip installation of attic when installed (#21)

This commit is contained in:
Paul Zinselmeyer 2024-05-25 10:29:36 +02:00 committed by GitHub
parent 37f74ba5fa
commit 5619ef4781
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View file

@ -1,12 +1,16 @@
import { install } from "./stages/install"; import { install, isInstalled } from "./stages/install";
import { configure } from "./stages/configure"; import { configure } from "./stages/configure";
import { push } from "./stages/push"; import { push } from "./stages/push";
import { getState, saveState } from "@actions/core"; import { getState, saveState, info } from "@actions/core";
const isPost = !!getState("isPost"); const isPost = !!getState("isPost");
const main = async () => { const main = async () => {
await install(); if (await isInstalled()) {
info("Skipping attic installation because it is already installed");
} else {
await install();
}
await configure(); await configure();
}; };

View file

@ -33,3 +33,8 @@ export const install = async () => {
core.endGroup(); core.endGroup();
}; };
export const isInstalled = async () => {
let return_code = await exec("attic", ["-V"]);
return return_code === 0;
};