1+ name : Cross-Page Integration Maintenance 
2+ 
3+ on :
4+   schedule :
5+     #  Run daily at 2 AM UTC
6+     - cron : ' 0 2 * * *' 
7+   push :
8+     branches : [ main ] 
9+     paths :
10+       - ' _docs/**' 
11+       - ' docs/**' 
12+       - ' index.html' 
13+       - ' includes/**' 
14+   pull_request :
15+     branches : [ main ] 
16+     paths :
17+       - ' _docs/**' 
18+       - ' docs/**' 
19+       - ' index.html' 
20+       - ' includes/**' 
21+   workflow_dispatch :
22+     inputs :
23+       maintenance_type :
24+         description : ' Type of maintenance to run' 
25+         required : true 
26+         default : ' full' 
27+         type : choice 
28+         options :
29+         - full 
30+         - links 
31+         - previews 
32+         - test 
33+ 
34+ jobs :
35+   cross-page-maintenance :
36+     runs-on : ubuntu-latest 
37+     
38+     steps :
39+     - name : Checkout repository 
40+       uses : actions/checkout@v4 
41+       
42+     - name : Setup Node.js 
43+       uses : actions/setup-node@v4 
44+       with :
45+         node-version : ' 18' 
46+         cache : ' npm' 
47+         
48+     - name : Install dependencies 
49+       run : npm ci 
50+       
51+     - name : Run Cross-Page Maintenance Tests 
52+       run : npm run test:cross-page-maintenance 
53+       
54+     - name : Run Link Integrity Check 
55+       run : npm run maintenance:cross-page:links 
56+       
57+     - name : Update Content Previews 
58+       run : npm run content:update-previews 
59+       
60+     - name : Run Full Maintenance (Scheduled) 
61+       if : github.event_name == 'schedule' 
62+       run : npm run maintenance:cross-page 
63+       
64+     - name : Run Specific Maintenance (Manual) 
65+       if : github.event_name == 'workflow_dispatch' 
66+       run : | 
67+         case "${{ github.event.inputs.maintenance_type }}" in 
68+           "links") 
69+             npm run maintenance:cross-page:links 
70+             ;; 
71+           "previews") 
72+             npm run content:update-previews 
73+             ;; 
74+           "test") 
75+             npm run maintenance:cross-page:test 
76+             ;; 
77+           *) 
78+             npm run maintenance:cross-page 
79+             ;; 
80+         esac 
81+          
82+      - name : Run Cross-Page Integration Tests 
83+       run : npm run test:cross-page-integration 
84+       
85+     - name : Upload Maintenance Reports 
86+       uses : actions/upload-artifact@v4 
87+       if : always() 
88+       with :
89+         name : maintenance-reports-${{ github.run_number }} 
90+         path : | 
91+           maintenance-logs/ 
92+           maintenance-reports/ 
93+          retention-days : 30 
94+         
95+     - name : Upload Test Results 
96+       uses : actions/upload-artifact@v4 
97+       if : always() 
98+       with :
99+         name : test-results-${{ github.run_number }} 
100+         path : | 
101+           maintenance-reports/cross-page-maintenance-test-report.json 
102+          retention-days : 7 
103+         
104+     - name : Comment PR with Results 
105+       if : github.event_name == 'pull_request' 
106+       uses : actions/github-script@v7 
107+       with :
108+         script : | 
109+           const fs = require('fs'); 
110+            
111+           try { 
112+             const reportPath = 'maintenance-reports/cross-page-maintenance-test-report.json'; 
113+             if (fs.existsSync(reportPath)) { 
114+               const report = JSON.parse(fs.readFileSync(reportPath, 'utf8')); 
115+                
116+               const body = `## Cross-Page Integration Test Results 
117+                
118+               **Summary:** 
119+               - Total Tests: ${report.summary.total} 
120+               - Passed: ${report.summary.passed} ✅ 
121+               - Failed: ${report.summary.failed} ❌ 
122+               - Success Rate: ${report.summary.successRate}% 
123+                
124+               ${report.summary.failed > 0 ? '**⚠️ Some tests failed. Please review the issues.**' : '**🎉 All tests passed!**'} 
125+                
126+               <details> 
127+               <summary>Detailed Results</summary> 
128+                
129+               ${report.details.map(test =>  
130+                 `- ${test.passed ? '✅' : '❌'} **${test.category}**: ${test.message}` 
131+               ).join('\n')} 
132+                
133+               </details>`; 
134+                
135+               github.rest.issues.createComment({ 
136+                 issue_number: context.issue.number, 
137+                 owner: context.repo.owner, 
138+                 repo: context.repo.repo, 
139+                 body: body 
140+               }); 
141+             } 
142+           } catch (error) { 
143+             console.log('Could not post test results:', error.message); 
144+           } 
145+            
146+      - name : Fail if Critical Issues Found 
147+       run : | 
148+         if [ -f "maintenance-reports/cross-page-maintenance-test-report.json" ]; then 
149+           FAILED_TESTS=$(node -e " 
150+             const report = require('./maintenance-reports/cross-page-maintenance-test-report.json'); 
151+             console.log(report.summary.failed); 
152+           ") 
153+            
154+           if [ "$FAILED_TESTS" -gt "0" ]; then 
155+             echo "❌ $FAILED_TESTS tests failed. Please review and fix the issues." 
156+             exit 1 
157+           fi 
158+         fi 
159+ 
160+    content-preview-update :
161+     runs-on : ubuntu-latest 
162+     if : github.event_name == 'push' && contains(github.event.head_commit.modified, '_docs/') 
163+     
164+     steps :
165+     - name : Checkout repository 
166+       uses : actions/checkout@v4 
167+       
168+     - name : Setup Node.js 
169+       uses : actions/setup-node@v4 
170+       with :
171+         node-version : ' 18' 
172+         cache : ' npm' 
173+         
174+     - name : Install dependencies 
175+       run : npm ci 
176+       
177+     - name : Update Content Previews 
178+       run : npm run content:update-previews 
179+       
180+     - name : Check for Changes 
181+       id : changes 
182+       run : | 
183+         if git diff --quiet; then 
184+           echo "changes=false" >> $GITHUB_OUTPUT 
185+         else 
186+           echo "changes=true" >> $GITHUB_OUTPUT 
187+         fi 
188+          
189+      - name : Commit Updated Previews 
190+       if : steps.changes.outputs.changes == 'true' 
191+       run : | 
192+         git config --local user.email "[email protected] " 193+         git config --local user.name "GitHub Action" 
194+         git add index.html 
195+         git commit -m "Auto-update content previews from documentation changes" || exit 0 
196+         git push 
0 commit comments