mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-06 04:01:23 +01:00
98 lines
3.7 KiB
YAML
98 lines
3.7 KiB
YAML
name: Trigger Docs Preview Build
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'docs/published/**'
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- 'docs/published/**'
|
|
|
|
permissions:
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
trigger-preview:
|
|
name: Trigger posthog.com preview build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Trigger Vercel build
|
|
id: trigger-build
|
|
env:
|
|
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
|
|
VERCEL_TEAM_ID: ${{ secrets.VERCEL_TEAM_ID }}
|
|
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
|
|
run: .github/scripts/trigger-vercel-preview.sh "${{ github.event.pull_request.head.ref || github.ref_name }}"
|
|
|
|
- name: Comment on PR
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const commentFn = require('./.github/scripts/comment-pr-preview.js');
|
|
await commentFn({
|
|
github,
|
|
context,
|
|
prNumber: ${{ github.event.pull_request.number }},
|
|
triggerStatus: "${{ steps.trigger-build.outputs.trigger_status }}",
|
|
deploymentUrl: "${{ steps.trigger-build.outputs.deployment_url }}",
|
|
deploymentId: "${{ steps.trigger-build.outputs.deployment_id }}"
|
|
});
|
|
|
|
validate-docs:
|
|
name: Validate docs structure
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Check frontmatter in published docs
|
|
run: |
|
|
echo "Checking for required frontmatter in published docs..."
|
|
|
|
MISSING_FRONTMATTER=0
|
|
|
|
# Find all markdown/mdx files in published docs
|
|
for file in docs/published/**/*.{md,mdx}; do
|
|
if [ -f "$file" ]; then
|
|
# Check if file starts with ---
|
|
if ! head -1 "$file" | grep -q "^---"; then
|
|
echo "❌ Missing frontmatter in: $file"
|
|
MISSING_FRONTMATTER=1
|
|
fi
|
|
fi
|
|
done
|
|
|
|
if [ $MISSING_FRONTMATTER -eq 1 ]; then
|
|
echo "Some files are missing required frontmatter. All docs in /docs/published/ must have YAML frontmatter."
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ All published docs have frontmatter"
|
|
|
|
- name: Verify internal docs not in published
|
|
run: |
|
|
echo "Verifying internal docs are not accidentally in published..."
|
|
|
|
if find docs/published -name "*internal*" -o -name "*private*" -o -name "*secret*" 2>/dev/null | grep -q .; then
|
|
echo "❌ Found internal/private docs in published directory!"
|
|
exit 1
|
|
fi
|
|
|
|
echo "✅ No internal docs found in published directory"
|
|
|
|
- name: Check for broken relative links
|
|
run: |
|
|
echo "Checking for obvious link issues..."
|
|
|
|
# Check for links pointing outside /published/
|
|
if grep -r '\[.*\](\.\.\/\.\./' docs/published/ 2>/dev/null; then
|
|
echo "⚠️ Found links that go outside /published/ directory - verify these are intentional"
|
|
else
|
|
echo "✅ Links appear to be within /published/ directory"
|
|
fi
|