This guide explains how the BetterGov documentation site automatically syncs with the main BetterGov repository to keep documentation up-to-date.
The documentation site automatically syncs with the main BetterGov repository through GitHub Actions:
- Frequency: Every 12 hours
- Trigger: Automated cron job
- Process: Checks for changes in documentation files and creates pull requests
- Trigger: Manual workflow dispatch
- Access: GitHub Actions tab → "Sync Documentation from BetterGov" → "Run workflow"
The following files are automatically synced from the main repository:
| Source File | Target Location | Description |
|---|---|---|
README.md |
content/docs/about.mdx |
Main project information |
docs/Meilisearch.md |
content/docs/meilisearch.mdx |
Search setup guide |
CONTRIBUTING.md |
content/docs/contributing/index.mdx |
Contributing guidelines |
CODE_OF_CONDUCT.md |
content/docs/contributing/code-of-conduct.mdx |
Community guidelines |
TESTING.md |
content/docs/contributing/testing.mdx |
Testing guide |
# Sync documentation files
npm run sync-docs# Fetch latest changes from upstream
git fetch upstream
# Check what files have changed
git diff HEAD upstream/main --name-only
# Merge specific documentation files
git checkout upstream/main -- README.md docs/ CONTRIBUTING.md CODE_OF_CONDUCT.md TESTING.md
# Commit the changes
git add .
git commit -m "docs: sync documentation from BetterGov repository"
git push- Fetch: Downloads latest content from BetterGov repository
- Transform: Converts markdown files to MDX format with proper frontmatter
- Validate: Checks file integrity and format
- Commit: Creates commit with synced changes
- PR: Creates pull request for review (if automated)
The sync process is configured in:
- Workflow:
.github/workflows/sync-docs.yml - Script:
scripts/sync-docs.js - Files: Defined in the sync script's
FILES_TO_SYNCarray
- Check GitHub Actions logs for detailed error messages
- Verify repository permissions and access tokens
- Ensure source files exist in the BetterGov repository
- Verify the file paths in the sync configuration
- Check if the source files have been moved or renamed
- Review the transform functions for proper content conversion
- The sync script includes delays to avoid GitHub API rate limits
- If you hit rate limits, wait before running manual syncs
To sync additional documentation files:
- Edit
scripts/sync-docs.js - Add new file configuration to
FILES_TO_SYNCarray:{ source: 'path/to/source.md', target: 'content/docs/target.mdx', transform: (content) => { const frontmatter = `---
`; return frontmatter + content; } }
3. **Test** the sync locally: `npm run sync-docs`
4. **Commit** the changes to enable automatic syncing
## Best Practices
- **Review Changes**: Always review synced content before merging
- **Test Locally**: Run `npm run sync-docs` locally before pushing changes
- **Monitor Logs**: Check GitHub Actions logs for sync status
- **Update Config**: Keep sync configuration up-to-date with repository changes
## Support
If you encounter issues with the sync process:
- Check the [GitHub Actions logs](https://github.com/Justin322322/BetterGov-Docs/actions)
- Open an issue in this repository
- Contact the maintainers for assistance