Skip to content

Commit d84de0a

Browse files
Copilotpkbullock
andcommitted
Add git submodules and automate cmdlet help updates
Co-authored-by: pkbullock <8781041+pkbullock@users.noreply.github.com>
1 parent f51d70e commit d84de0a

File tree

9 files changed

+1809
-1696
lines changed

9 files changed

+1809
-1696
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Update Cmdlet Help
2+
on:
3+
schedule:
4+
# Run monthly on the 1st day at 00:00 UTC
5+
- cron: '0 0 1 * *'
6+
workflow_dispatch: # Allow manual triggering
7+
8+
jobs:
9+
update-help:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
15+
steps:
16+
- name: Checkout repository with submodules
17+
uses: actions/checkout@v4
18+
with:
19+
submodules: recursive
20+
fetch-depth: 0
21+
22+
- name: Update submodules to latest
23+
run: |
24+
git submodule update --remote --merge
25+
26+
- name: Run Get-HelpJson.ps1
27+
shell: pwsh
28+
run: |
29+
cd docfx
30+
./Get-HelpJson.ps1
31+
32+
- name: Check for changes
33+
id: check_changes
34+
run: |
35+
if git diff --quiet docfx/assets/help/*.help.json; then
36+
echo "has_changes=false" >> $GITHUB_OUTPUT
37+
else
38+
echo "has_changes=true" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Create Pull Request
42+
if: steps.check_changes.outputs.has_changes == 'true'
43+
uses: peter-evans/create-pull-request@v6
44+
with:
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
commit-message: 'Update cmdlet help documentation'
47+
title: 'Update Cmdlet Help Documentation'
48+
body: |
49+
## Automated Cmdlet Help Update
50+
51+
This PR updates the cmdlet help documentation by pulling the latest changes from the upstream repositories:
52+
- [pnp/powershell](https://github.com/pnp/powershell)
53+
- [pnp/cli-microsoft365](https://github.com/pnp/cli-microsoft365)
54+
- [MicrosoftDocs/OfficeDocs-SharePoint-PowerShell](https://github.com/MicrosoftDocs/OfficeDocs-SharePoint-PowerShell)
55+
56+
The following help files have been updated:
57+
- `docfx/assets/help/powershell.help.json` - PnP PowerShell cmdlets
58+
- `docfx/assets/help/cli.help.json` - CLI for Microsoft 365 commands
59+
- `docfx/assets/help/spoms.help.json` - SharePoint Online Management Shell cmdlets
60+
61+
Please review the changes and merge if everything looks correct.
62+
branch: automated/update-cmdlet-help
63+
delete-branch: true
64+
labels: |
65+
automated
66+
documentation

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "docfx/help-repos/pnp-powershell"]
2+
path = docfx/help-repos/pnp-powershell
3+
url = https://github.com/pnp/powershell.git
4+
[submodule "docfx/help-repos/cli-microsoft365"]
5+
path = docfx/help-repos/cli-microsoft365
6+
url = https://github.com/pnp/cli-microsoft365.git
7+
[submodule "docfx/help-repos/OfficeDocs-SharePoint-PowerShell"]
8+
path = docfx/help-repos/OfficeDocs-SharePoint-PowerShell
9+
url = https://github.com/MicrosoftDocs/OfficeDocs-SharePoint-PowerShell.git

docfx/Get-HelpJson.ps1

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,15 @@ function Process-CliForM365Docs
119119
# For optimatization - only use help where cmdlet is used
120120

121121
# To refresh functions use . .\Get-HelpJson.ps1 in cmd window
122-
$currentLocation = "C:\git\readonly\script-samples-help\"
123-
$outputPath = "$(Get-Location)\assets\help"
122+
# Get the script directory and calculate paths relative to it
123+
$scriptPath = if ($PSScriptRoot) { $PSScriptRoot } else { Get-Location }
124+
$currentLocation = Join-Path -Path $scriptPath -ChildPath "help-repos"
125+
$outputPath = Join-Path -Path $scriptPath -ChildPath "assets\help"
126+
127+
# Ensure output directory exists
128+
if (!(Test-Path -Path $outputPath)) {
129+
New-Item -ItemType Directory -Path $outputPath -Force | Out-Null
130+
}
124131

125132
Process-PnPPowerShellDocs
126133
Process-SPOManagementShellDocs

0 commit comments

Comments
 (0)