Compare commits
4 commits
eb8fd0b651
...
776421884b
Author | SHA1 | Date | |
---|---|---|---|
776421884b | |||
e6d631994e | |||
7dc9f06e47 | |||
aff3a8180a |
2 changed files with 18 additions and 8 deletions
|
@ -45,11 +45,7 @@ def clone_project_branch() -> None:
|
||||||
|
|
||||||
|
|
||||||
def install_actions() -> None:
|
def install_actions() -> None:
|
||||||
"""Make actions usable in workflows.
|
"""Make actions usable in workflows."""
|
||||||
|
|
||||||
:param path: entry point file
|
|
||||||
:type path: Path
|
|
||||||
"""
|
|
||||||
step("Install actions")
|
step("Install actions")
|
||||||
name = "action.yaml"
|
name = "action.yaml"
|
||||||
root = project.root / "act"
|
root = project.root / "act"
|
||||||
|
|
20
spcd/act.py
20
spcd/act.py
|
@ -1,6 +1,7 @@
|
||||||
"""Actions available for workflows."""
|
"""Actions available for workflows."""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
from ast import literal_eval
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from rwx import ps
|
from rwx import ps
|
||||||
|
@ -9,13 +10,26 @@ from rwx.log import stream as log
|
||||||
from spcd.ci import project, projects
|
from spcd.ci import project, projects
|
||||||
from spcd.shell import env
|
from spcd.shell import env
|
||||||
|
|
||||||
|
PREFIX = "INPUT_"
|
||||||
|
|
||||||
|
|
||||||
def action() -> None:
|
def action() -> None:
|
||||||
"""Display action inputs."""
|
"""Display action inputs."""
|
||||||
prefix = "INPUT_"
|
for variable, value in parse_inputs().items():
|
||||||
|
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()):
|
for variable, value in sorted(projects.environment.items()):
|
||||||
if variable.startswith(prefix):
|
if variable.startswith(PREFIX):
|
||||||
log.info("%s = %s", variable, value)
|
d[variable.removeprefix(PREFIX)] = literal_eval(value)
|
||||||
|
return d
|
||||||
|
|
||||||
|
|
||||||
def synchronize(source: str | None = None, target: str | None = None) -> None:
|
def synchronize(source: str | None = None, target: str | None = None) -> None:
|
||||||
|
|
Loading…
Reference in a new issue