Skip to content

Commit 4ab9c09

Browse files
Copilotneilime
authored andcommitted
feat: implement documentation aggregation system
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent 412f233 commit 4ab9c09

File tree

11 files changed

+1079
-9
lines changed

11 files changed

+1079
-9
lines changed

.env

Whitespace-only changes.

.github/EXAMPLES.md

Lines changed: 285 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,285 @@
1+
# Documentation Sync - Usage Examples
2+
3+
This document provides examples of how to use the repository_dispatch-based documentation sync system.
4+
5+
## Basic Examples
6+
7+
### Example 1: Basic Configuration
8+
9+
Minimal configuration for syncing documentation:
10+
11+
```yaml
12+
name: Push Documentation to Portal
13+
14+
on:
15+
push:
16+
branches:
17+
- main
18+
paths:
19+
- "docs/**"
20+
- "README.md"
21+
workflow_dispatch:
22+
23+
jobs:
24+
push-docs:
25+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
26+
with:
27+
source_repo: "my-project"
28+
target_path: "projects/my-project"
29+
secrets:
30+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
31+
```
32+
33+
### Example 2: Custom Documentation Path
34+
35+
If your documentation is in a non-standard location:
36+
37+
```yaml
38+
jobs:
39+
push-docs:
40+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
41+
with:
42+
source_repo: "my-project"
43+
docs_path: "documentation"
44+
target_path: "projects/my-project"
45+
include_readme: false
46+
secrets:
47+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
48+
```
49+
50+
### Example 3: Sync from Multiple Branches
51+
52+
Sync documentation from both main and develop branches:
53+
54+
```yaml
55+
on:
56+
push:
57+
branches:
58+
- main
59+
- develop
60+
paths:
61+
- "docs/**"
62+
- "README.md"
63+
64+
jobs:
65+
push-docs-main:
66+
if: github.ref == 'refs/heads/main'
67+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
68+
with:
69+
source_repo: "my-project"
70+
target_path: "projects/my-project"
71+
branch: "main"
72+
secrets:
73+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
74+
75+
push-docs-dev:
76+
if: github.ref == 'refs/heads/develop'
77+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
78+
with:
79+
source_repo: "my-project"
80+
target_path: "projects/my-project-dev"
81+
branch: "develop"
82+
secrets:
83+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
84+
```
85+
86+
### Example 4: With Manual Trigger Only
87+
88+
For projects that want to control when documentation is synced:
89+
90+
```yaml
91+
on:
92+
workflow_dispatch:
93+
inputs:
94+
sync_readme:
95+
description: "Include README.md"
96+
required: false
97+
type: boolean
98+
default: true
99+
100+
jobs:
101+
push-docs:
102+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
103+
with:
104+
source_repo: "my-project"
105+
target_path: "projects/my-project"
106+
include_readme: ${{ inputs.sync_readme }}
107+
secrets:
108+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
109+
```
110+
111+
## Testing
112+
113+
### Testing the Dispatcher
114+
115+
1. Set up the workflow in your project repository
116+
2. Add the `PUBLIC_DOCS_TOKEN` secret with `repo` scope
117+
3. Make a commit to `docs/**` or `README.md`
118+
4. Check the Actions tab in your repository for dispatcher execution
119+
5. Check the Actions tab in public-docs for receiver execution
120+
6. Verify the documentation appears in the portal
121+
122+
### Local Testing
123+
124+
You can't test the dispatcher locally, but you can validate your documentation:
125+
126+
```bash
127+
# In your project repository
128+
cd docs
129+
# Ensure all markdown files are valid
130+
find . -name "*.md" -exec markdown-lint {} \;
131+
```
132+
133+
## Troubleshooting
134+
135+
### Workflow not triggering
136+
137+
**Symptoms:**
138+
139+
```
140+
No workflow runs appear in Actions tab
141+
```
142+
143+
**Solutions:**
144+
145+
1. Verify the workflow file is in `.github/workflows/` directory
146+
2. Check the `paths` filter matches your documentation structure
147+
3. Ensure you're pushing to the correct branch
148+
4. Validate the workflow YAML syntax
149+
150+
### Token permission errors
151+
152+
**Symptoms:**
153+
154+
```
155+
❌ Error: Resource not accessible by integration
156+
```
157+
158+
**Solutions:**
159+
160+
1. Verify `PUBLIC_DOCS_TOKEN` secret exists in your repository
161+
2. Ensure the token has `repo` scope (not just `public_repo`)
162+
3. Confirm the token hasn't expired
163+
4. Test token permissions:
164+
```bash
165+
curl -H "Authorization: token $TOKEN" \
166+
https://api.github.com/repos/hoverkraft-tech/public-docs/dispatches
167+
```
168+
169+
### Documentation not appearing
170+
171+
**Symptoms:**
172+
173+
```
174+
Dispatcher runs successfully but docs don't appear in portal
175+
```
176+
177+
**Solutions:**
178+
179+
1. Check if receiver workflow ran in public-docs
180+
2. Review receiver workflow logs for build validation errors
181+
3. Verify the `target_path` is correct
182+
4. Ensure documentation files are `.md` or `.mdx`
183+
5. Check that frontmatter in docs is valid YAML
184+
185+
### Build validation fails
186+
187+
**Symptoms:**
188+
189+
```
190+
Receiver workflow fails during build step
191+
```
192+
193+
**Solutions:**
194+
195+
1. Review the build logs in the receiver workflow
196+
2. Common issues:
197+
- Invalid Markdown syntax
198+
- Broken frontmatter YAML
199+
- Invalid relative links
200+
- Missing images or assets referenced in docs
201+
3. Test locally in public-docs:
202+
```bash
203+
# Clone public-docs
204+
git clone https://github.com/hoverkraft-tech/public-docs
205+
cd public-docs/application
206+
# Add your docs manually to test
207+
npm ci
208+
npm run build
209+
```
210+
211+
### Large documentation bundles
212+
213+
**Symptoms:**
214+
215+
```
216+
❌ Error: Payload too large
217+
```
218+
219+
**Solutions:**
220+
221+
1. GitHub Actions has limits on payload size
222+
2. Reduce documentation size:
223+
- Move large images to a separate hosting service
224+
- Split very large documents into smaller files
225+
- Exclude unnecessary files from docs directory
226+
3. Consider using Git submodules for very large documentation sets
227+
228+
## Best Practices
229+
230+
1. **Keep documentation focused**: Only include necessary documentation files
231+
2. **Validate locally**: Test Markdown and build before committing
232+
3. **Use frontmatter**: Add metadata to help with organization
233+
4. **Monitor workflows**: Check both dispatcher and receiver logs regularly
234+
5. **Test incrementally**: Push small changes to verify everything works
235+
6. **Use semantic paths**: Choose clear, descriptive target_path values
236+
237+
## Advanced Usage
238+
239+
### Conditional Syncing
240+
241+
Only sync when specific files change:
242+
243+
```yaml
244+
on:
245+
push:
246+
branches:
247+
- main
248+
paths:
249+
- "docs/**/*.md"
250+
- "!docs/drafts/**"
251+
252+
jobs:
253+
push-docs:
254+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
255+
with:
256+
source_repo: "my-project"
257+
target_path: "projects/my-project"
258+
secrets:
259+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
260+
```
261+
262+
### Multiple Documentation Sections
263+
264+
Sync different documentation sections to different paths:
265+
266+
```yaml
267+
jobs:
268+
push-user-docs:
269+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
270+
with:
271+
source_repo: "my-project"
272+
docs_path: "docs/users"
273+
target_path: "projects/my-project/users"
274+
secrets:
275+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
276+
277+
push-dev-docs:
278+
uses: hoverkraft-tech/public-docs/.github/workflows/sync-docs-dispatcher.yml@main
279+
with:
280+
source_repo: "my-project"
281+
docs_path: "docs/developers"
282+
target_path: "projects/my-project/developers"
283+
secrets:
284+
PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }}
285+
```

0 commit comments

Comments
 (0)