Template management tool consuming shared templates from SRR-shared-resources.
This repository receives automatic updates of Jinja2, TextFSM, TTP, JSNAPy, and table view templates from the central shared resources repository.
Template editing and management tool that uses shared templates for:
- Jinja2 configuration templates
- TextFSM parsing templates
- TTP (Template Text Parser) templates
- JSNAPy test templates
- Table view configurations
Shared folders synced from SRR-shared-resources:
jinja2/→template/jinja2/textfsm/→template/textfsm/ttp/→template/ttp/jsnapy/→template/jsnapy/tableview/→template/tableview/
SRR-template-editor/
├── .github/
│ └── workflows/
│ ├── auto-pr-shared-resources.yml # [Auto] Creates PR for downstream updates
│ └── trigger-shared-resource-update.yml # [Auto] Sends changes upstream
├── template/ # Synced folders
│ ├── jinja2/ # Jinja2 templates (synced)
│ ├── textfsm/ # TextFSM parsers (synced)
│ ├── ttp/ # TTP templates (synced)
│ ├── jsnapy/ # JSNAPy tests (synced)
│ └── tableview/ # Table views (synced)
└── [other template-editor specific files]
- Shared resources repo pushes update to any template folder
- This repo's
sync-autobranch automatically updated - Auto-PR created:
sync-auto→main - Your job: Review PR, check tests pass, merge
Time: PR appears ~60 seconds after shared repo push
- Edit files in
template/jinja2/,textfsm/,ttp/,jsnapy/, ortableview/ - Commit to
main(NO[auto-sync]tag) - Workflow detects change, sends webhook to shared repo
- Shared repo creates PR with your changes
- Shared repo maintainer reviews and merges
- Your changes propagate to other consumers
Time: PR in shared repo appears ~45 seconds after your push
# 1. Edit template
vim template/jinja2/interface-config.j2
# 2. Commit and push to main
git add template/jinja2/interface-config.j2
git commit -m "Add VLAN support to interface template"
git push origin main
# 3. Workflow sends change to shared repo automatically
# 4. Wait for PR in shared repo
# 5. After merge there, change propagates to other consumers❌ Never commit to sync-auto branch
- This branch is force-pushed by shared repo
- Your commits will be lost on next sync
❌ Don't delete synced folders
- They'll reappear on next sync
- Update
consumer-config.ymlin shared repo instead
❌ Don't bypass workflows
- Commits with
[auto-sync]tag won't trigger upstream sync - This prevents infinite loops
Trigger: Push to sync-auto branch
Function: Creates PR when shared repo syncs updates
Output: PR from sync-auto → main
Trigger: Push to main affecting template folders
Function: Sends webhook to shared repo
Output: PR created in shared repo with your changes
Path filters configured:
paths:
- 'template/jinja2/**'
- 'template/textfsm/**'
- 'template/ttp/**'
- 'template/jsnapy/**'
- 'template/tableview/**'Changes outside these paths don't trigger upstream sync.
main- Production
sync-auto- Receives updates from shared repo, force-pushed on every sync- DO NOT commit manually
- Source branch for auto-created PRs
- Wiped and rebuilt on every sync
Type: Built-in token Setup: Settings → Actions → General
- ✅ "Read and write permissions"
- ✅ "Allow GitHub Actions to create and approve pull requests"
Used by: auto-pr-shared-resources.yml to create PRs
Type: Personal Access Token
Access: SRR-shared-resources repository
Permissions: Write access for repository_dispatch
Used by: trigger-shared-resource-update.yml to send webhooks
When PR appears from sync-auto → main:
Check:
- Files changed match expected template folders
- No unexpected deletions
- CI/tests pass (template syntax validation)
- Diff looks reasonable
Don't worry about:
- Commit history (snapshot-based, no history from shared repo)
- Merge conflicts (impossible with force-push strategy)
- Multiple commits (always single commit per sync)
Merge if: Tests pass and changes look correct
Cause: Folder content unchanged since last sync Fix: Close PR, not a bug
Cause: Changed files outside template/ subfolders
Fix: Only changes to jinja2, textfsm, ttp, jsnapy, tableview trigger upstream sync
Cause: GITHUB_TOKEN lacks permissions Fix: Settings → Actions → General → Enable "Read and write" + "Allow PR creation"
Cause: SHARED_REPO_PAT invalid or expired Fix: Regenerate token, update secret in Settings → Secrets
Full troubleshooting: See ai_spec_v4/07_TROUBLESHOOTING.md in demo folder
Automated commits from shared repo are tagged:
[auto-sync][template-editor] update shared folders
Source: moophat/SRR-shared-resources@abc123
trigger-shared-resource-update.yml skips commits containing [auto-sync] - prevents infinite loops.
Deletions in shared repo propagate automatically to this repo.
Example: Shared repo deletes jinja2/old-template.j2 → deleted here on next sync.
This is intentional (keeps consumers in sync with shared repo state).
-
Update
.github/consumer-config.ymlin shared repo:template-editor: folders: jinja2: template/jinja2 textfsm: template/textfsm ttp: template/ttp jsnapy: template/jsnapy tableview: template/tableview new-folder: template/new-folder # Add this
-
Update
trigger-shared-resource-update.ymlin this repo:paths: - 'template/jinja2/**' - 'template/textfsm/**' - 'template/ttp/**' - 'template/jsnapy/**' - 'template/tableview/**' - 'template/new-folder/**' # Add this
-
Push to shared repo
main- new folder syncs automatically
Recommended: Add CI checks to validate template syntax:
- Jinja2: Check for syntax errors
- TextFSM: Validate template structure
- TTP: Verify template parsing
- JSNAPy: YAML syntax validation
This catches errors before they propagate to other consumers.
Full system documentation: ai_spec_v4/ folder in demo repository
Questions? Check shared resources repo or ai_spec_v4/00_OVERVIEW_v4.md