|
| 1 | +# Cmdlet Help Automation |
| 2 | + |
| 3 | +This directory contains automation for updating cmdlet help documentation from external repositories. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The cmdlet help documentation is automatically synchronized from three upstream repositories using Git submodules: |
| 8 | + |
| 9 | +- **PnP PowerShell**: [pnp/powershell](https://github.com/pnp/powershell) |
| 10 | +- **CLI for Microsoft 365**: [pnp/cli-microsoft365](https://github.com/pnp/cli-microsoft365) |
| 11 | +- **SharePoint Online Management Shell**: [MicrosoftDocs/OfficeDocs-SharePoint-PowerShell](https://github.com/MicrosoftDocs/OfficeDocs-SharePoint-PowerShell) |
| 12 | + |
| 13 | +## Git Submodules |
| 14 | + |
| 15 | +The submodules are located in `docfx/help-repos/` directory: |
| 16 | + |
| 17 | +``` |
| 18 | +docfx/help-repos/ |
| 19 | +├── pnp-powershell/ |
| 20 | +├── cli-microsoft365/ |
| 21 | +└── OfficeDocs-SharePoint-PowerShell/ |
| 22 | +``` |
| 23 | + |
| 24 | +### Working with Submodules |
| 25 | + |
| 26 | +To clone the repository with submodules: |
| 27 | +```bash |
| 28 | +git clone --recurse-submodules https://github.com/pnp/script-samples.git |
| 29 | +``` |
| 30 | + |
| 31 | +To update submodules to the latest version: |
| 32 | +```bash |
| 33 | +git submodule update --remote --merge |
| 34 | +``` |
| 35 | + |
| 36 | +## Automation |
| 37 | + |
| 38 | +### Monthly Updates |
| 39 | + |
| 40 | +A GitHub Action workflow (`.github/workflows/update-cmdlet-help.yml`) runs monthly on the 1st day of each month to: |
| 41 | + |
| 42 | +1. Update all submodules to their latest versions |
| 43 | +2. Run `Get-HelpJson.ps1` to regenerate help JSON files |
| 44 | +3. Create a pull request if changes are detected |
| 45 | + |
| 46 | +### Manual Updates |
| 47 | + |
| 48 | +You can manually trigger the workflow from the GitHub Actions tab or run the script locally: |
| 49 | + |
| 50 | +```powershell |
| 51 | +cd docfx |
| 52 | +./Get-HelpJson.ps1 |
| 53 | +``` |
| 54 | + |
| 55 | +## Get-HelpJson.ps1 |
| 56 | + |
| 57 | +This PowerShell script processes the documentation from the submodules and generates JSON files containing cmdlet names and their documentation URLs. |
| 58 | + |
| 59 | +### Generated Files |
| 60 | + |
| 61 | +The script generates the following files in `docfx/assets/help/`: |
| 62 | + |
| 63 | +- `powershell.help.json` - PnP PowerShell cmdlets |
| 64 | +- `cli.help.json` - CLI for Microsoft 365 commands |
| 65 | +- `spoms.help.json` - SharePoint Online Management Shell cmdlets |
| 66 | + |
| 67 | +These JSON files are used by the documentation website to provide quick links to cmdlet documentation. |
| 68 | + |
| 69 | +## Benefits |
| 70 | + |
| 71 | +- **Always up-to-date**: Monthly automatic updates ensure documentation links stay current |
| 72 | +- **Human review**: All updates go through a PR review process |
| 73 | +- **Traceability**: Git submodules track exact versions of upstream documentation |
| 74 | +- **No manual maintenance**: Eliminates the need to manually sync documentation |
0 commit comments