Root Organization CI/CD ValidationΒΆ
Last Updated: 2026-06-22
Automated validation workflow for root folder organization operations.
OverviewΒΆ
The root-org-validation.yml workflow provides automated validation for root organization operations, ensuring zero-break guarantee through pre/post validation checks.
Workflow FileΒΆ
Location: .github/workflows/root-org-validation.yml
TriggersΒΆ
Automatic (Pull Request)ΒΆ
Triggered when PR affects root-level files:
- *.md, *.py, *.yml, *.yaml, *.json, *.toml, *.txt
- scripts/root_org/**
- .codex/plans/**
- .codex/inventory.json
Manual (workflow_dispatch)ΒΆ
Usage:
# Via GitHub UI: Actions β Root Organization Validation β Run workflow
# Via GitHub CLI:
gh workflow run root-org-validation.yml \
-f file_to_validate=QUICKSTART.md \
-f dry_run=true
JobsΒΆ
1. Pre-ValidationΒΆ
Purpose: Establish baseline metrics before any changes
Steps: - Link checker (markdown-link-check) - Pytest baseline - Ruff linter - MkDocs build (if mkdocs.yml exists)
Outputs:
- baseline_metrics - JSON with results
- validation-baseline artifact
2. Reference CheckΒΆ
Purpose: Validate all references and imports
Steps: - Scan changed files for broken references - Validate Python import paths - Check GitHub Actions workflow paths - Generate reference validation report
Outputs:
- reference-validation-report artifact
3. Post-ValidationΒΆ
Purpose: Compare current state with baseline
Steps: - Download baseline metrics - Compare with current state - Detect regressions - Generate final report - Comment on PR (if applicable)
Outputs:
- root-org-validation-report artifact
- PR comment with results
4. SummaryΒΆ
Purpose: Aggregate all results
Steps: - Generate GitHub step summary - List all artifacts - Report overall status
ArtifactsΒΆ
validation-baselineΒΆ
Retention: 7 iterations
Content: Baseline metrics from pre-validation
Format: Text file with timestamped results
reference-validation-reportΒΆ
Retention: 30 iterations
Content: Reference check results
Format: Markdown report
root-org-validation-reportΒΆ
Retention: 90 iterations
Content: Complete validation report
Format: Markdown with all job results
IntegrationΒΆ
With Root Organization ScriptsΒΆ
# Example: Validate before move
- name: Validate file
run: python scripts/root_org/validate_references.py ${{ matrix.file }} --dry-run
# Example: Check references after move
- name: Check references
run: |
python scripts/root_org/validate_references.py ${{ matrix.new_path }}
With Custom AgentsΒΆ
# Example: Use root-organizer-agent
- name: Assess risk
run: |
# Agent would analyze risk level
# And provide recommendations
Validation ChecksΒΆ
Link CheckerΒΆ
- Checks all Markdown links
- Validates relative and absolute paths
- Reports broken links
- Continues on error (baseline recorded)
Pytest BaselineΒΆ
- Runs full test suite
- Records pass/fail status
- Continues on error (establishes baseline)
Ruff LinterΒΆ
- Checks code quality
- Identifies import errors
- Reports statistics
- Continues on error (baseline recorded)
MkDocs BuildΒΆ
- Attempts strict build
- Records warnings
- Only runs if mkdocs.yml exists
- Continues on error (baseline recorded)
Python Import ValidationΒΆ
- Compiles Python files
- Checks import statements
- Reports ModuleNotFoundError
- Validates up to 20 files (performance)
Workflow Path ValidationΒΆ
- Validates YAML syntax
- Checks workflow file structure
- Reports parsing errors
Error HandlingΒΆ
Continue-on-Error StrategyΒΆ
Most validation steps use continue-on-error: true to:
- Establish baseline even if checks fail
- Record current state for comparison
- Not block on pre-existing issues
- Focus on regressions
Failure ConditionsΒΆ
Workflow fails if: - Critical job failure (pre-validation, reference-check) - Post-validation detects regressions - Unable to generate reports
Usage ExamplesΒΆ
Example 1: PR ValidationΒΆ
# Automatically triggered on PR
git checkout -b feature/move-files
git mv QUICKSTART.md docs/QUICKSTART.md
python scripts/root_org/update_links_atomic.py --old QUICKSTART.md --new docs/QUICKSTART.md
git commit -m "Move QUICKSTART.md to docs/"
git push origin feature/move-files
# Create PR β Workflow runs automatically
Example 2: Manual ValidationΒΆ
# Via GitHub CLI
gh workflow run root-org-validation.yml \
-f file_to_validate=.codex/archive/deprecated/AGENTS.md \
-f dry_run=false
# Check run status
gh run list --workflow=root-org-validation.yml --limit 1
# Download artifacts
gh run download <run_id> -n root-org-validation-report
Example 3: Local TestingΒΆ
# Install dependencies
pip install pytest ruff mypy markdown-link-check
# Run validation steps locally
python scripts/root_org/validate_references.py README.md --dry-run
pytest tests/ -v
ruff check . --select E,F,W --statistics
mkdocs build --strict
MonitoringΒΆ
Check Workflow StatusΒΆ
# List recent runs
gh run list --workflow=root-org-validation.yml
# View specific run
gh run view <run_id>
# Download artifacts
gh run download <run_id>
Review PR CommentsΒΆ
Workflow automatically comments on PRs with: - Validation status - Link to artifacts - Recommendations - Any issues found
TroubleshootingΒΆ
"Workflow not triggering"ΒΆ
Cause: Changed files don't match paths filter Solution: Check paths in workflow trigger, add file patterns if needed
"Baseline artifact not found"ΒΆ
Cause: Pre-validation job failed Solution: Review pre-validation logs, fix critical errors
"Reference check fails"ΒΆ
Cause: Broken references detected
Solution: Run validate_references.py locally, fix references
"Post-validation detects regressions"ΒΆ
Cause: Current state worse than baseline Solution: Review changes, run validation locally before committing
ConfigurationΒΆ
Customize ValidationΒΆ
Edit .github/workflows/root-org-validation.yml:
Change file patterns:
Adjust retention:
Add custom checks:
Best PracticesΒΆ
- Run locally first - Test validation before pushing
- Check artifacts - Review reports for detailed findings
- Monitor baselines - Track metrics over time
- Address regressions - Fix issues detected by post-validation
- Keep workflow updated - Add checks as needed
Metrics TrackedΒΆ
- Link check pass/fail rate
- Pytest test count and failures
- Ruff violations count
- MkDocs build success rate
- Import errors count
- Workflow run duration
Future EnhancementsΒΆ
Planned improvements: - [ ] Parallel validation for speed - [ ] Advanced diff analysis (pre vs post) - [ ] Integration with GitHub Status API - [ ] Slack/email notifications - [ ] Automatic issue creation on failure - [ ] Historical metrics dashboard - [ ] Performance benchmarking
SupportΒΆ
For issues: - Check workflow logs in GitHub Actions - Review artifact reports - Run validation scripts locally - Contact: @mbaetiong
Version: 1.0.0
Created: 2026-01-21
Status: β
Production Ready
Integration: root-org scripts, custom agents