forked from Mirror/attic-action
feat: skip installation of attic when installed (#21)
This commit is contained in:
parent
37f74ba5fa
commit
5619ef4781
2 changed files with 12 additions and 3 deletions
|
@ -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 () => {
|
||||||
|
if (await isInstalled()) {
|
||||||
|
info("Skipping attic installation because it is already installed");
|
||||||
|
} else {
|
||||||
await install();
|
await install();
|
||||||
|
}
|
||||||
await configure();
|
await configure();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in a new issue