From 886fcf3673aadca4d64361f0078d5b752c6d4c62 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 20 Oct 2024 18:52:16 +0200 Subject: [PATCH] action --- spcd/__init__.py | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/spcd/__init__.py b/spcd/__init__.py index 2064a3d..cf40de2 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -44,7 +44,7 @@ def clone_project_branch() -> None: ) -def install_actions(path: Path) -> None: +def install_actions() -> None: """Make actions usable in workflows. :param path: entry point file @@ -54,21 +54,34 @@ def install_actions(path: Path) -> None: name = "action.yaml" root = project.root / "act" vpy = Path(env.SPCD_PYTHON_VENV_BINARIES) / "python" - action = "synchronize" - log.info(action) - directory = root / action - fs.make_directory(directory) - fs.write(directory / name, f"""\ + for action in ["action", "synchronize"]: + log.info(action) + directory = root / action + fs.make_directory(directory) + match action: + case "action": + yaml = """\ +inputs: + arg-1: + required: true + arg_2: + required: true +""" + case "synchronize": + yaml = """\ inputs: source: default: out required: false +""" + yaml = f"""{yaml}\ runs: using: composite steps: - - run: {vpy} -m spcd synchronize -""") - cat(directory / name) + - run: {vpy} -m spcd {action} +""" + fs.write(directory / name, yaml) + cat(directory / name) def install_commands(path: Path) -> None: