On this page
Monorepo sync command and helpers: trigger rewriting, working-directory injection, router workflow generation, and tag prefix configuration.
#rlsbl.commands.monorepo.sync
#rlsbl.commands.monorepo.sync
Monorepo sync command and all sync helpers: trigger rewriting, working-directory injection, router generation.
#parse_ci_workflow
def parse_ci_workflow(content)Parse CI workflow YAML content using round-trip mode (preserves comments, ordering).
Returns the parsed document, or None if the content is empty or has no jobs: key.
#emit_ci_workflow
def emit_ci_workflow(doc)Serialize a parsed workflow document back to YAML string.
Uses round-trip mode to preserve comment annotations and key order from the original parse.
#_rewrite_trigger
def _rewrite_trigger(doc)Replace the on: trigger with workflow_call: in a parsed YAML document.
YAML 1.1 treats bare on as boolean True, so the key may appear as either the string 'on' or the boolean True depending on the parser mode. Round-trip mode preserves the original text, but we check both forms defensively.
#_inject_working_directory
def _inject_working_directory(doc, path)Add defaults.run.working-directory to each job in a parsed YAML document.
Merges with existing defaults.run (e.g. preserving shell) rather than overwriting. Only adds working-directory if it is not already present.
#_rewrite_version_file_inputs
def _rewrite_version_file_inputs(doc, project_path)Prefix version-file values with project path in setup actions.
Actions like actions/setup-go resolve go-version-file relative to the repo root, not working-directory. When a workflow is copied into a monorepo sub-project we must adjust these inputs so the runner can still find the file.
Known inputs: go-version-file, python-version-file, node-version-file.
#_inject_packages_dir
def _inject_packages_dir(doc, project_path)Add packages-dir to PyPI publish steps.
When working-directory is set, uv build creates artifacts in {project_path}/dist/ but the publish action looks for dist/ at the repo root. We inject packages-dir so it finds the right directory.
#_generate_router
def _generate_router(projects)Generate ci-router.yml content from project list.
Builds the router as a structured dict and serializes with emit_ci_workflow for consistent YAML output.
#_get_monorepo_tag_prefix
def _get_monorepo_tag_prefix(project, root)Return the tag prefix for a monorepo project's publish router condition.
Uses the target's monorepo_tag_glob to derive the prefix (glob minus trailing *). For Go projects this yields go/v, for others name@v.