-
Notifications
You must be signed in to change notification settings - Fork 3.5k
68 lines (56 loc) · 2.39 KB
/
Copy pathdocs-preview-trigger.yml
File metadata and controls
68 lines (56 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Trigger Docs Preview Build
on:
pull_request:
paths:
- 'docs/**'
push:
branches:
- master
paths:
- 'docs/**'
permissions:
contents: read
jobs:
trigger-preview:
# Skip merge-queue branches. No gate coverage is lost: the frontmatter,
# internal-docs and link checks below are all continue-on-error, so they
# never blocked a merge anyway.
if: ${{ !startsWith(github.head_ref, 'trunk-merge/') }}
name: Trigger posthog.com preview build
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Check frontmatter in published docs
continue-on-error: true
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
continue-on-error: true
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 links
continue-on-error: true
run: node .github/scripts/check-docs-links.js