|
| 1 | +name: Debug Strapi Documentation Style Review |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + pr_number: |
| 7 | + description: 'PR number to validate (leave empty for current branch)' |
| 8 | + required: false |
| 9 | + type: string |
| 10 | + |
| 11 | +jobs: |
| 12 | + debug-validation: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Setup Node.js |
| 19 | + uses: actions/setup-node@v4 |
| 20 | + with: |
| 21 | + node-version: '20' |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + cd docusaurus |
| 26 | + yarn add --dev js-yaml glob |
| 27 | +
|
| 28 | + - name: Debug - Check file structure |
| 29 | + run: | |
| 30 | + echo "=== Repository structure ===" |
| 31 | + ls -la |
| 32 | + echo "=== Docusaurus directory ===" |
| 33 | + ls -la docusaurus/ |
| 34 | + echo "=== Scripts directory ===" |
| 35 | + ls -la docusaurus/scripts/ || echo "scripts directory not found" |
| 36 | + echo "=== Style validation directory ===" |
| 37 | + ls -la docusaurus/scripts/style-validation/ || echo "style-validation directory not found" |
| 38 | + echo "=== Docs directory ===" |
| 39 | + ls -la docusaurus/docs/ | head -10 |
| 40 | +
|
| 41 | + - name: Test validation script existence |
| 42 | + run: | |
| 43 | + echo "=== Checking validation script ===" |
| 44 | + if [ -f "docusaurus/scripts/style-validation/validate-content-style.js" ]; then |
| 45 | + echo "✅ Validation script found" |
| 46 | + echo "--- Script content preview ---" |
| 47 | + head -20 docusaurus/scripts/style-validation/validate-content-style.js |
| 48 | + else |
| 49 | + echo "❌ Validation script NOT found" |
| 50 | + fi |
| 51 | +
|
| 52 | + - name: Test rule parser existence |
| 53 | + run: | |
| 54 | + echo "=== Checking rule parser ===" |
| 55 | + if [ -f "docusaurus/scripts/style-validation/rule-parser.js" ]; then |
| 56 | + echo "✅ Rule parser found" |
| 57 | + else |
| 58 | + echo "❌ Rule parser NOT found" |
| 59 | + fi |
| 60 | +
|
| 61 | + - name: Test YAML config existence |
| 62 | + run: | |
| 63 | + echo "=== Checking YAML config ===" |
| 64 | + if [ -f "docusaurus/scripts/style-validation/style-rules.yml" ]; then |
| 65 | + echo "✅ YAML config found" |
| 66 | + echo "--- Config preview ---" |
| 67 | + head -10 docusaurus/scripts/style-validation/style-rules.yml |
| 68 | + else |
| 69 | + echo "❌ YAML config NOT found" |
| 70 | + fi |
| 71 | +
|
| 72 | + - name: Try running validation with debug |
| 73 | + run: | |
| 74 | + cd docusaurus |
| 75 | + echo "=== Attempting to run validation ===" |
| 76 | + if [ -f "scripts/style-validation/validate-content-style.js" ]; then |
| 77 | + echo "Running validation script..." |
| 78 | + node scripts/style-validation/validate-content-style.js --verbose || echo "Validation script failed" |
| 79 | + else |
| 80 | + echo "Creating minimal test to see what happens..." |
| 81 | + mkdir -p scripts/style-validation |
| 82 | + echo "console.log('Test script running'); process.exit(0);" > scripts/style-validation/test.js |
| 83 | + node scripts/style-validation/test.js |
| 84 | + fi |
| 85 | +
|
| 86 | + - name: Check if results file was created |
| 87 | + run: | |
| 88 | + echo "=== Checking for results file ===" |
| 89 | + if [ -f "docusaurus/style-check-results.json" ]; then |
| 90 | + echo "✅ Results file found!" |
| 91 | + cat docusaurus/style-check-results.json |
| 92 | + else |
| 93 | + echo "❌ Results file NOT created" |
| 94 | + fi |
| 95 | +
|
| 96 | + - name: Simple comment test (only if PR number provided) |
| 97 | + if: github.event.inputs.pr_number != '' |
| 98 | + uses: actions/github-script@v7 |
| 99 | + with: |
| 100 | + script: | |
| 101 | + console.log('Testing simple comment...'); |
| 102 | + try { |
| 103 | + await github.rest.issues.createComment({ |
| 104 | + issue_number: parseInt('${{ github.event.inputs.pr_number }}'), |
| 105 | + owner: context.repo.owner, |
| 106 | + repo: context.repo.repo, |
| 107 | + body: '🧪 **Debug Test Comment**\n\nThis is a test to verify commenting works.\n\nWorkflow debug completed successfully!' |
| 108 | + }); |
| 109 | + console.log('✅ Comment posted successfully!'); |
| 110 | + } catch (error) { |
| 111 | + console.log('❌ Comment failed:', error.message); |
| 112 | + } |
0 commit comments