diff --git a/spcd/act.py b/spcd/act.py index 203528e..625e7fc 100644 --- a/spcd/act.py +++ b/spcd/act.py @@ -1,6 +1,7 @@ """Actions available for workflows.""" import os +from ast import literal_eval from pathlib import Path from rwx import ps @@ -9,15 +10,29 @@ from rwx.log import stream as log from spcd.ci import project, projects from spcd.shell import env +PREFIX = "INPUT_" + def action() -> None: """Display action inputs.""" - prefix = "INPUT_" for variable, value in sorted(projects.environment.items()): - if variable.startswith(prefix): + if variable.startswith(PREFIX): log.info("%s = %s", variable, value) +def parse_inputs() -> dict[str, object]: + """Parse inputs as a dictionary. + + :return: name & value pairs + :rtype: dict[str, object] + """ + d = {} + for variable, value in sorted(projects.environment.items()): + if variable.startswith(PREFIX): + d[variable] = literal_eval(value) + return d + + def synchronize(source: str | None = None, target: str | None = None) -> None: """Synchronize output towards a target.