Problem
The .github/workflows/update-repo.yml file has become bloated with inline bash scripts that handle:
- Package downloading from GitHub releases
- Metadata extraction and parsing
- Package routing to distribution-specific pools
- GPG key import and signing configuration
This makes the workflow file:
- Hard to test independently
- Difficult to maintain and modify
- Impossible to reuse scripts in other workflows
- Not suitable for local testing during development
Solution
Extract the complex bash script logic from the workflow into dedicated shell script files in /scripts/ directory:
-
scripts/download-packages.sh - Download packages from GitHub releases
- Handle release version resolution (latest, prerelease, specific tag)
- Manage package download and temporary file handling
- Validate downloaded packages with dpkg-deb
-
scripts/route-packages.sh - Route packages to distribution pools
- Source routing functions
- Implement routing logic for distro expansion
- Handle legacy routing for any/hatlabs packages
-
scripts/gpg-setup.sh - GPG configuration
- Import signing keys
- Extract key IDs
- Set environment variables
-
Update workflow to call these scripts instead of containing inline logic
Benefits
- ✅ Scripts can be unit tested independently
- ✅ Easy to debug locally before committing
- ✅ Code reuse across multiple workflows
- ✅ Cleaner, more maintainable workflow files
- ✅ Easier to onboard new contributors
- ✅ Better error handling and logging
Implementation Notes
Follow the DEVELOPMENT_WORKFLOW.md for this refactoring.
Implementation Checklist
Phase 1: EXPLORE (No Coding!)
Phase 2: PLAN
Phase 3: TEST (TDD)
Phase 4: IMPLEMENT
Phase 5: VERIFY
Phase 6: COMMIT
Success Criteria
- ✅ All new scripts have unit tests (100% coverage)
- ✅ Workflow file is significantly simplified
- ✅ All existing functionality preserved
- ✅ Scripts are independently testable
- ✅ No regression in CI/CD behavior
- ✅ Documentation updated
Related
Remember: This is a refactoring task - Quality > Speed. Take time to plan and test thoroughly.
Problem
The
.github/workflows/update-repo.ymlfile has become bloated with inline bash scripts that handle:This makes the workflow file:
Solution
Extract the complex bash script logic from the workflow into dedicated shell script files in
/scripts/directory:scripts/download-packages.sh- Download packages from GitHub releasesscripts/route-packages.sh- Route packages to distribution poolsscripts/gpg-setup.sh- GPG configurationUpdate workflow to call these scripts instead of containing inline logic
Benefits
Implementation Notes
Follow the DEVELOPMENT_WORKFLOW.md for this refactoring.
Implementation Checklist
Phase 1: EXPLORE (No Coding!)
/docs/SPEC.mdrelevant sections/docs/ARCHITECTURE.mdrelevant sectionsTask tool with subagent_type=Explorefor complex navigationPhase 2: PLAN
think hardto evaluate approachesPhase 3: TEST (TDD)
git commit -m "test: add script tests"Phase 4: IMPLEMENT
scripts/download-packages.shscripts/route-packages.shscripts/gpg-setup.shPhase 5: VERIFY
Phase 6: COMMIT
git commit -m "refactor: extract workflow scripts"Success Criteria
Related
Remember: This is a refactoring task - Quality > Speed. Take time to plan and test thoroughly.