Removed duplicate product doc directories #4
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: MDX Validation | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- 'docs/**/*.md' | |
- 'docs/**/*.mdx' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- 'docs/**/*.md' | |
- 'docs/**/*.mdx' | |
jobs: | |
test-mdx: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Run MDX Test Suite | |
run: npm run test:mdx:suite | |
- name: Upload test report | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: mdx-test-report | |
path: mdx-test-report.json | |
- name: Comment PR with results | |
if: github.event_name == 'pull_request' && failure() | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const fs = require('fs'); | |
const report = JSON.parse(fs.readFileSync('mdx-test-report.json', 'utf8')); | |
const comment = `## MDX Validation Results | |
❌ **${report.summary.invalid} files** failed validation | |
<details> | |
<summary>View details</summary> | |
${report.results | |
.filter(r => !r.valid) | |
.map(r => `- \`${r.file}\`: ${r.error}`) | |
.join('\n')} | |
</details> | |
Run \`npm run test:mdx:fix\` locally to fix common issues automatically.`; | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: comment | |
}) |