|
1 | 1 | # Documentation Aggregation - Usage Examples |
2 | 2 |
|
3 | | -This document provides examples of how to use the documentation aggregation system in both pull and push modes. |
4 | | - |
5 | | -## Pull Mode Examples |
6 | | - |
7 | | -These examples are for the `.github/docs-sources.yml` configuration file. |
8 | | - |
9 | | -### Example 1: Basic Configuration |
10 | | - |
11 | | -Add a simple repository with documentation in a `docs/` folder: |
12 | | - |
13 | | -```yaml |
14 | | -repositories: |
15 | | - - repository: my-project |
16 | | - enabled: true |
17 | | - docs_path: docs |
18 | | - target_path: projects/my-project |
19 | | - branch: main |
20 | | - description: My awesome project |
21 | | -``` |
22 | | -
|
23 | | -## Example 2: README Only |
24 | | -
|
25 | | -Pull only the README.md from a repository: |
26 | | -
|
27 | | -```yaml |
28 | | -repositories: |
29 | | - - repository: simple-tool |
30 | | - enabled: true |
31 | | - files: |
32 | | - - README.md |
33 | | - target_path: projects/simple-tool |
34 | | - branch: main |
35 | | - description: A simple tool |
36 | | -``` |
37 | | -
|
38 | | -## Example 3: Custom Documentation Path |
39 | | -
|
40 | | -If your documentation is in a non-standard location: |
41 | | -
|
42 | | -```yaml |
43 | | -repositories: |
44 | | - - repository: custom-project |
45 | | - enabled: true |
46 | | - docs_path: documentation |
47 | | - target_path: projects/custom-project |
48 | | - branch: develop |
49 | | - description: Project with custom docs path |
50 | | -``` |
51 | | -
|
52 | | -## Example 4: With Exclusions |
53 | | -
|
54 | | -Exclude certain files or patterns: |
55 | | -
|
56 | | -```yaml |
57 | | -repositories: |
58 | | - - repository: big-project |
59 | | - enabled: true |
60 | | - docs_path: docs |
61 | | - target_path: projects/big-project |
62 | | - exclude: |
63 | | - - "*.draft.md" |
64 | | - - "internal/**" |
65 | | - - "wip-*.md" |
66 | | - description: Big project with internal docs |
67 | | -``` |
68 | | -
|
69 | | -## Example 5: Multiple Specific Files |
70 | | -
|
71 | | -Pull multiple specific files: |
72 | | -
|
73 | | -```yaml |
74 | | -repositories: |
75 | | - - repository: api-project |
76 | | - enabled: true |
77 | | - files: |
78 | | - - README.md |
79 | | - - docs/api-reference.md |
80 | | - - docs/getting-started.md |
81 | | - target_path: projects/api-project |
82 | | - branch: main |
83 | | - description: API project with specific docs |
84 | | -``` |
| 3 | +This document provides examples of how to use the push-based documentation aggregation system. |
85 | 4 |
|
86 | 5 | ## Push Mode Examples |
87 | 6 |
|
88 | 7 | These examples are for workflows in **project repositories** that push their documentation to public-docs. |
89 | 8 |
|
90 | | -### Example 6: Basic Push Mode |
| 9 | +### Example 1: Basic Push Mode |
91 | 10 |
|
92 | 11 | Minimal configuration for pushing documentation on every commit: |
93 | 12 |
|
|
113 | 32 | PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }} |
114 | 33 | ``` |
115 | 34 |
|
116 | | -### Example 7: Push with Custom Docs Path |
| 35 | +### Example 2: Push with Custom Docs Path |
117 | 36 |
|
118 | 37 | If your documentation is in a non-standard location: |
119 | 38 |
|
|
130 | 49 | PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }} |
131 | 50 | ``` |
132 | 51 |
|
133 | | -### Example 8: Push from Multiple Branches |
| 52 | +### Example 3: Push from Multiple Branches |
134 | 53 |
|
135 | 54 | Sync documentation from both main and develop branches: |
136 | 55 |
|
@@ -166,73 +85,42 @@ jobs: |
166 | 85 | PUBLIC_DOCS_TOKEN: ${{ secrets.PUBLIC_DOCS_TOKEN }} |
167 | 86 | ``` |
168 | 87 |
|
169 | | -### Example 9: Combined Pull and Push |
170 | | -
|
171 | | -Use both modes for redundancy and verification: |
172 | | -
|
173 | | -1. **In project repository** - Add push workflow for immediate updates |
174 | | -2. **In public-docs** - Keep pull configuration as backup |
175 | | -
|
176 | | -This ensures documentation is always up-to-date with push mode, while pull mode serves as a scheduled verification. |
177 | | -
|
178 | | -## Testing Locally |
179 | | -
|
180 | | -### Testing Pull Mode |
181 | | -
|
182 | | -```bash |
183 | | -# Set your GitHub token |
184 | | -export GITHUB_TOKEN="your_token_here" |
185 | | - |
186 | | -# Pull documentation |
187 | | -cd application |
188 | | -npm run pull-docs |
189 | | - |
190 | | -# View the results |
191 | | -ls -la docs/projects/ |
192 | | - |
193 | | -# Build to test |
194 | | -npm run build |
195 | | -``` |
196 | | - |
197 | | -### Testing Push Mode |
| 88 | +## Testing |
198 | 89 |
|
199 | | -Push mode can only be tested by: |
| 90 | +Push mode can be tested by: |
200 | 91 | 1. Setting up the workflow in your project repository |
201 | 92 | 2. Adding the `PUBLIC_DOCS_TOKEN` secret |
202 | 93 | 3. Making a commit to `docs/**` or `README.md` |
203 | 94 | 4. Checking the Actions tab for workflow execution |
| 95 | +5. Verifying the documentation appears in the portal |
204 | 96 |
|
205 | 97 | ## Troubleshooting |
206 | 98 |
|
207 | | -### Repository not found |
208 | | - |
209 | | -``` |
210 | | -❌ Failed to pull from my-project: Not Found |
211 | | -``` |
| 99 | +### Workflow not triggering |
212 | 100 |
|
213 | 101 | **Solution**: Check that: |
214 | | -1. The repository exists in the hoverkraft-tech organization |
215 | | -2. Your GitHub token has access to read the repository |
216 | | -3. The repository name is spelled correctly |
| 102 | +1. The workflow file is in `.github/workflows/` directory |
| 103 | +2. The paths match your documentation structure |
| 104 | +3. You're pushing to the correct branch |
| 105 | +4. The workflow has no syntax errors |
217 | 106 |
|
218 | | -### Documentation path not found |
| 107 | +### Token permission errors |
219 | 108 |
|
220 | 109 | ``` |
221 | | -⚠️ Path not found: my-project/docs |
| 110 | +❌ Permission denied |
222 | 111 | ``` |
223 | 112 |
|
224 | 113 | **Solution**: Check that: |
225 | | -1. The `docs_path` matches the actual directory in the repository |
226 | | -2. The branch specified exists |
227 | | -3. The directory contains files (not empty) |
228 | | - |
229 | | -### File size limit exceeded |
| 114 | +1. `PUBLIC_DOCS_TOKEN` secret is configured in your project repository |
| 115 | +2. The token has `contents: write` permission for public-docs repository |
| 116 | +3. The token hasn't expired |
230 | 117 |
|
231 | | -``` |
232 | | -⚠️ Skipping large-file.md (exceeds max size: 2048000 bytes) |
| 118 | +### Documentation not appearing |
233 | 119 | ``` |
234 | 120 |
|
235 | | -**Solution**: Either: |
236 | | -1. Increase `max_file_size` in settings |
237 | | -2. Split the large file into smaller files |
238 | | -3. Exclude the large file and link to it in GitHub instead |
| 121 | +**Solution**: Check that: |
| 122 | +1. The workflow executed successfully (check Actions tab in project repo) |
| 123 | +2. The `target_path` is correct |
| 124 | +3. The documentation files are `.md` or `.mdx` |
| 125 | +4. The public-docs repository was updated (check recent commits) |
| 126 | +5. The portal was rebuilt and deployed |
0 commit comments