feat: universal document parser - PDF/DOCX/DOC/HWP/HWPX + content-bas… #69
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Document Drift Validation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - develop | |
| - claude/* | |
| paths: | |
| - '**.md' | |
| - 'flamehaven_filesearch/**' | |
| - '.github/workflows/doc-drift.yml' | |
| pull_request: | |
| paths: | |
| - '**.md' | |
| - 'flamehaven_filesearch/**' | |
| workflow_dispatch: | |
| env: | |
| # Metric Thresholds | |
| README_SCORE_THRESHOLD: '0.6' | |
| MAX_BROKEN_LINKS: '3' | |
| MAX_WARNINGS: '20' | |
| # Slop Detection Settings | |
| SLOP_DETECTION_ENABLED: 'true' | |
| MAX_SLOP_TERMS: '0' # Zero tolerance for hype terms | |
| jobs: | |
| validate-drift: | |
| runs-on: ubuntu-latest | |
| name: Validate Documentation Drift | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 # Optimized: only need current state for file scanning | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| - name: Run document drift validation | |
| id: run_validation | |
| run: | | |
| set +e # Continue on error | |
| python tools/drift_validator.py \ | |
| --project-root . \ | |
| --report .audit/doc_drift_report.json | |
| exit_code=$? | |
| echo "validator_exit_code=$exit_code" >> $GITHUB_OUTPUT | |
| if [ $exit_code -ne 0 ]; then | |
| echo "::warning::Drift validator exited with code $exit_code" | |
| fi | |
| # Ensure report file exists | |
| if [ ! -f .audit/doc_drift_report.json ]; then | |
| echo "::error::Report file not generated" | |
| mkdir -p .audit | |
| echo '{"metrics":{"readme_score":0,"coherence_score":0,"errors":["Report generation failed"],"warnings":[]}}' > .audit/doc_drift_report.json | |
| fi | |
| - name: Run Slop Detection (Sanity Enforcer) | |
| id: run_slop_check | |
| if: env.SLOP_DETECTION_ENABLED == 'true' | |
| run: | | |
| python tools/slop_detector.py \ | |
| --project-root . \ | |
| --input-report .audit/doc_drift_report.json \ | |
| --output-report .audit/doc_drift_report.json | |
| - name: Check documentation health | |
| id: check_health | |
| run: | | |
| python tools/report_health_checker.py \ | |
| --report .audit/doc_drift_report.json \ | |
| --readme-threshold ${{ env.README_SCORE_THRESHOLD }} \ | |
| --max-broken-links ${{ env.MAX_BROKEN_LINKS }} \ | |
| --max-warnings ${{ env.MAX_WARNINGS }} \ | |
| --max-slop-errors ${{ env.MAX_SLOP_TERMS }} \ | |
| --slop-severity error | |
| - name: Upload report artifact | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: doc-drift-report-${{ github.run_number }} | |
| path: .audit/doc_drift_report.json | |
| retention-days: 90 | |
| - name: Generate summary | |
| if: always() | |
| run: | | |
| python tools/report_summary_generator.py \ | |
| --report .audit/doc_drift_report.json \ | |
| --output-format step-summary | |
| - name: Generate PR comment body | |
| if: github.event_name == 'pull_request' && always() | |
| run: | | |
| python tools/report_summary_generator.py \ | |
| --report .audit/doc_drift_report.json \ | |
| --output-format pr-comment \ | |
| --output .audit/pr_comment.md | |
| - name: Comment PR with report | |
| if: github.event_name == 'pull_request' && always() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| try { | |
| const body = fs.readFileSync('.audit/pr_comment.md', 'utf8'); | |
| await github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: body | |
| }); | |
| } catch (error) { | |
| console.error('Failed to post PR comment:', error); | |
| core.warning('Could not post PR comment'); | |
| } | |
| summary: | |
| runs-on: ubuntu-latest | |
| name: Validation Summary | |
| if: always() | |
| needs: validate-drift | |
| steps: | |
| - name: Check validation results | |
| run: | | |
| result="${{ needs.validate-drift.result }}" | |
| if [ "$result" = "failure" ]; then | |
| echo "::error::Validation failed" | |
| exit 1 | |
| else | |
| echo "::notice::✅ Validation passed" | |
| fi |