From 80e54a0ea5f39e5c0762562148ac4e494f0625ed Mon Sep 17 00:00:00 2001 From: "Sean (ANGRYxScotsman)" <36518683+seanh1995@users.noreply.github.com> Date: Wed, 18 Feb 2026 17:51:44 +0000 Subject: [PATCH] updated doc workflow (#4069) * updated workflow * changed the commit message * fixed spacing in copyright i will notice these issues before committing in future lol * Update devdocs-generator.md --- .github/workflows/docs.yaml | 13 ++++++++++++- docs/i18n/en.yaml | 2 +- tools/devdocs-generator.md | 29 +++++++++++++++++------------ 3 files changed, 30 insertions(+), 14 deletions(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 8e212ed9..e0c04262 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -12,7 +12,7 @@ on: workflow_dispatch: permissions: - contents: read + contents: write pages: write id-token: write @@ -50,6 +50,17 @@ jobs: run: | Set-Location tools ./devdocs-generator.ps1 + - name: Commit generated docs + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add docs/content/dev/ + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "regenerated dev docs from workflow" + git push + fi - name: Install Node.js dependencies run: "cd docs && [[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" - name: Cache Restore diff --git a/docs/i18n/en.yaml b/docs/i18n/en.yaml index 38c617fb..ba84014d 100644 --- a/docs/i18n/en.yaml +++ b/docs/i18n/en.yaml @@ -1,4 +1,4 @@ -copyright: "©   Chris Titus Tech. All rights reserved." +copyright: "©  Chris Titus Tech. All rights reserved." backToTop: "Scroll to top" changeLanguage: "Change language" diff --git a/tools/devdocs-generator.md b/tools/devdocs-generator.md index fd04129a..41d56d3b 100644 --- a/tools/devdocs-generator.md +++ b/tools/devdocs-generator.md @@ -7,11 +7,12 @@ description: "How the devdocs-generator.ps1 script works" The `devdocs-generator.ps1` script automatically generates Hugo-compatible markdown files for the development documentation. It pulls content directly from the JSON config files and PowerShell function files so the docs never go out of sync. -## When Does It Run? +## When Does it Run? -- Automatically in CI via the GitHub Actions `docs.yaml` workflow before Hugo builds the site -- Triggered when any of these change: `docs/**`, `config/tweaks.json`, `config/feature.json`, `functions/**` -- Can also be run manually with `workflow_dispatch` +- Automatically triggered by the `docs.yaml` GitHub Actions workflow, which generates the `.md` files, commits them back to the repo, and then triggers Hugo to build the site +- Automatically runs during the pre-release workflow, committing the updated `"link"` properties back to the JSON config files +- Watches `docs/**`, `config/tweaks.json`, `config/feature.json`, and `functions/**` for changes +- Supports manual runs via `workflow_dispatch` ## What Does It Do? @@ -25,6 +26,7 @@ The `devdocs-generator.ps1` script automatically generates Hugo-compatible markd - Adds or updates a `"link"` property on every entry in both JSON config files - Each link points to that entry's documentation page on the Hugo site +- The updated links are automatically committed back to the JSON config files as part of the pre-release workflow ### 3. Cleans Up Old Docs @@ -58,7 +60,7 @@ For each entry in `feature.json` that belongs to a documented category: The script generates docs for entries in these categories: - Essential Tweaks -- z__Advanced Tweaks - CAUTION +- z--Advanced-Tweaks---CAUTION - Customize Preferences - Performance Plans - Features @@ -84,17 +86,20 @@ docs/content/dev/ The script strips common prefixes from the JSON key names using the pattern `WPF(WinUtil|Toggle|Features?|Tweaks?|Panel|Fix(es)?)?`. For example: -| JSON Key | Generated File | -|---|---| -| `WPFTweaksHiber` | `Hiber.md` | -| `WPFTweaksDeBloat` | `DeBloat.md` | -| `WPFFeatureshyperv` | `hyperv.md` | -| `WPFPanelDISM` | `DISM.md` | +| JSON Key | Generated File | +| ------------------- | -------------- | +| `WPFTweaksHiber` | `Hiber.md` | +| `WPFTweaksDeBloat` | `DeBloat.md` | +| `WPFFeatureshyperv` | `hyperv.md` | +| `WPFPanelDISM` | `DISM.md` | ## Key Points - The JSON config files are the single source of truth - Manual edits to generated `.md` files will be overwritten on the next run -- The script does not touch `_index.md` files or `architecture.md` +- The script does not modify `_index.md` or `architecture.md` + — do not delete `_index.md` or `architecture.md`, as they will need to be recreated manually. - Category directories are created automatically if they don't exist - The `"link"` property added to JSON entries is excluded from the displayed code blocks +- The `docs` workflow generates the `.md` files and commits them back to the repo before Hugo builds the site +- The `pre-release` workflow generates the `"link"` properties and commits them back to the repo