parse_inputs

This commit is contained in:
Marc Beninca 2024-10-21 14:55:43 +02:00
parent aff3a8180a
commit 7dc9f06e47
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -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.