Skip to content

Complete missing paragraphs in welcome.md, Fix broken accessibility settings link in setup-guide.md, Correct NVDA modifier key in keyboard-shortcuts.md #41

Complete missing paragraphs in welcome.md, Fix broken accessibility settings link in setup-guide.md, Correct NVDA modifier key in keyboard-shortcuts.md

Complete missing paragraphs in welcome.md, Fix broken accessibility settings link in setup-guide.md, Correct NVDA modifier key in keyboard-shortcuts.md #41

name: Accessibility & Content Validation
# Validates markdown, links, and accessibility standards
# Runs on all PR updates so students get instant feedback
on:
pull_request:
types: [opened, edited, synchronize, reopened]
permissions:
contents: read
pull-requests: write
issues: write
jobs:
validate-content:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Python dependencies
run: |
pip install requests markupsafe
- name: Install Node dependencies
run: npm ci
- name: Check for broken links
id: links
run: |
python .github/scripts/check_links.py . || true
- name: Validate markdown structure
id: markdown
run: |
python .github/scripts/check_markdown.py . || true
- name: Validate accessibility
id: accessibility
run: |
python .github/scripts/check_accessibility.py . || true
- name: Post validation feedback
if: always()
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
let feedback = { errors: [], warnings: [], accessibility: [] };
try {
if (fs.existsSync('validation-feedback.json')) {
const newFeedback = JSON.parse(fs.readFileSync('validation-feedback.json', 'utf8'));
feedback = { ...feedback, ...newFeedback };
}
} catch (error) {
console.error('Error reading validation feedback:', error);
}
let comment = `## 📋 Content Validation Report\n\n`;
const hasErrors = feedback.errors && feedback.errors.length > 0;
const hasWarnings = feedback.warnings && feedback.warnings.length > 0;
const hasA11y = feedback.accessibility && feedback.accessibility.length > 0;
if (!hasErrors && !hasWarnings && !hasA11y) {
comment += `✅ **All checks passed!** Your content looks great!\n\n`;
} else {
if (hasErrors) {
comment += `### ❌ Required Fixes\n\n`;
feedback.errors.forEach(err => {
comment += `- **${err.file}** (Line ${err.line || '?'}):\n`;
comment += ` ${err.message}\n`;
if (err.fix) {
comment += ` **Fix:** ${err.fix}\n`;
}
comment += `\n`;
});
}
if (hasWarnings) {
comment += `### ⚠️ Suggestions\n\n`;
feedback.warnings.forEach(warn => {
comment += `- **${warn.file}**:\n`;
comment += ` ${warn.message}\n`;
});
comment += `\n`;
}
if (hasA11y) {
comment += `### ♿ Accessibility\n\n`;
feedback.accessibility.forEach(item => {
comment += `- **${item.title}** (\`${item.file}\` Line ${item.line || '?'})\n`;
comment += ` ${item.message}\n`;
if (item.fix) {
comment += ` **Fix:** ${item.fix}\n`;
}
comment += `\n`;
});
}
}
comment += `### 📚 Learning Resources\n\n`;
comment += `- [GitHub Flavored Markdown](../docs/04-markdown-reference.md)\n`;
comment += `- [Accessibility Standards](../docs/05-accessibility-reference.md)\n`;
comment += `- [Content Guidelines](../docs/06-content-guidelines.md)\n\n`;
comment += `---\n`;
comment += `*Automated validation by Learning Room. Questions? Check the guides or mention @facilitator.*`;
try {
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number
});
const botComment = comments.find(c =>
c.user.type === 'Bot' &&
c.body.includes('Content Validation Report')
);
if (botComment) {
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: botComment.id,
body: comment
});
} else {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.payload.pull_request.number,
body: comment
});
}
} catch (error) {
console.error('Error posting comment:', error);
}