templates
templates
Workflow template files for syncweaver.
Templates can be listed and copied into downstream host repository or package repos using the helper functions below or via the CLI:
syncweaver templates list
syncweaver templates add syncweaver-update-source --output .github/workflows/
syncweaver templates add syncweaver-notify-host-update-source --output .github/workflows/
Use available_templates_markdown() to render the current template inventory.
Functions
available_templates_markdown
templates.available_templates_markdown()
Build a markdown bullet list of currently available template files.
Returns
| str |
str |
Markdown-formatted bullet list. |
Examples
>>> available_templates_markdown()
list_templates
templates.list_templates()
List available workflow templates.
Returns
|
list[str] |
list[str]: Template file names. |
read_template
templates.read_template(template_name)
Read a template file’s contents.
Parameters
| template_name |
str |
Name of the template file (with or without .yml extension). |
required |
Returns
| str |
str |
Contents of the template file. |
Raises
|
FileNotFoundError |
If the template file does not exist. |
Examples
>>> read_template("host-repo-pattern1-outbound.yml")
use_template
templates.use_template(
template_name,
output_dir='.github/workflows',
overwrite=False,
)
Copy a workflow template into the specified output directory.
Parameters
| template_name |
str |
Name of the template file (with or without .yml extension). |
required |
| output_dir |
str | pathlib.Path |
Directory to write the template. Defaults to .github/workflows. |
'.github/workflows' |
| overwrite |
bool |
If True, overwrite an existing file. Defaults to False. |
False |
Returns
|
pathlib.Path |
pathlib.Path: Path to the written file. |
Raises
|
FileNotFoundError |
If the template does not exist. |
|
FileExistsError |
If the destination file already exists and overwrite is False. |
Examples
>>> use_template("host-repo-pattern1-outbound.yml")