with one click
enroll-repo-in-template
// Enable an existing Tera template for a downstream repo in the repo-templates system
// Enable an existing Tera template for a downstream repo in the repo-templates system
| name | enroll-repo-in-template |
| description | Enable an existing Tera template for a downstream repo in the repo-templates system |
config.yamlmakeconfig.yaml under repos:config.yaml under templates:tmpl8 renderer (for validation)# Interactive mode - will ask which template and repo
/enroll-repo-in-template
# Specify template and repo
/enroll-repo-in-template --template shellcheck --repo coreos-assembler
# With variable overrides
/enroll-repo-in-template --template shellcheck --repo coreos-assembler --vars 'branches: [main, rhel-*]'
If the user did not provide arguments, determine the template and repo interactively.
Get the template name:
Read config.yaml and extract the templates: list to show available templates:
grep -A 100 '^templates:' config.yaml
Ask the user which template they want to enable if not specified.
Get the repo name:
Read config.yaml and extract the repos: list to show available repos:
grep -E '^\s{2}\w' config.yaml | sed 's/://g' | awk '{print $1}'
Ask the user which repo they want to enroll if not specified.
Check repo exists in config.yaml:
grep -q "^ REPO_NAME:" config.yaml
If the repo does NOT exist, stop and tell the user to add it first (or suggest running the "onboard-repo" skill if it exists).
Check template is registered:
Verify the template appears in the templates: list in config.yaml.
Check repo is not already enrolled:
For each template config YAML file, check that the repo is not already listed:
grep -q "repo: REPO_NAME" TEMPLATE_DIR/CONFIG.yaml
If already enrolled, inform the user and stop.
Templates may have one or more YAML config files. Determine which ones exist:
ls TEMPLATE_DIR/*.yaml
For example:
shellcheck has script.yaml AND workflow.yaml (both need entries)gemini has just config.yaml (one entry needed)dependabot has just dependabot.yaml (one entry needed)Read each YAML config file to understand:
vars: at the top of the filepath: pattern used by existing entriesvars: overridesFor each config YAML file:
Determine the path: - Look at existing entries. If all repos use the same path, use that. If paths vary, ask the user.
Determine vars: overrides - Read the template-level vars: defaults. Ask the user if they need to override any variables. Present the available variables and their defaults.
Find insertion point - Entries in the files: list should be in alphabetical order by repo name. Find the correct position.
For each template config YAML file, use the Edit tool to insert the new entry.
Format for entry WITHOUT vars overrides:
- repo: REPO_NAME
path: OUTPUT_PATH
Format for entry WITH vars overrides:
- repo: REPO_NAME
path: OUTPUT_PATH
vars:
VAR_NAME: VAR_VALUE
Important formatting rules:
- repo: line (under files:)path: and vars:files: listAfter making changes, validate the template renders correctly:
# Build the renderer if not already built
cd tmpl8 && cargo build
# Render all templates and show diffs
make diff
Or just render the output tree:
make output
Check that:
output/REPO_NAME/OUTPUT_PATHTell the user:
container/container.yaml -> .github/workflows/container.ymlcontainer/container-rebuild.yaml -> .github/workflows/container-rebuild.ymlcopr/Makefile.yaml -> Makefiledependabot/dependabot.yaml -> .github/dependabot.ymlfcos/release-checklist.yaml -> .github/ISSUE_TEMPLATE/{stream}.mdgemini/config.yaml -> .gemini/config.yamlgo/release-checklist.yaml -> .github/ISSUE_TEMPLATE/release-checklist.mdgo/signing-ticket.yaml -> signing-ticket.shgo/tag_release.yaml -> tag_release.shgo/tests.yaml -> .github/workflows/go.ymlgo/tests-ignition.yaml -> .github/workflows/go.ymlowners-file-action/owners-file-action.yaml -> .github/workflows/owners-file-action.ymlrelease-notes/require-release-note.yaml -> .github/workflows/require-release-note.ymlrust/release-checklist.yaml -> .github/ISSUE_TEMPLATE/release-checklist.mdrust/rpm-test.yaml -> .github/workflows/rpm-test.ymlrust/tests.yaml -> .github/workflows/rust.ymlshellcheck/ -> script.yaml (path: ci/shellcheck) + workflow.yaml (path: .github/workflows/shellcheck.yml)find-whitespace/ -> script.yaml (path: ci/find-whitespace) + workflow.yaml (path: .github/workflows/find-whitespace.yml)docs/ -> coreos.yaml covers both docs/_config.yml and docs/assets/css/coreos.scssThis skill automates the following manual steps:
config.yaml (use the "onboard-repo" skill or do manually).yml Tera template files themselves)When you run /enroll-repo-in-template --template gemini/config --repo fedora-coreos-pipeline:
Validating prerequisites...
Repo 'fedora-coreos-pipeline' exists in config.yaml
Template 'gemini/config.yml' is registered in config.yaml
Repo is not already enrolled in gemini/config
Reading template config: gemini/config.yaml
Default vars: branches: [main]
Common path: .gemini/config.yaml
Config files to update: 1
Adding entry to gemini/config.yaml...
Inserted after 'fedora-coreos-config', before 'ignition'
Validating render...
make output completed successfully
Output file: output/fedora-coreos-pipeline/.gemini/config.yaml
Done! Files modified:
- gemini/config.yaml (+3 lines)
Next steps:
1. Review the changes with 'git diff'
2. Commit and create a PR
3. CI will validate rendering and show diffs against downstream repos