From e11b3ae60685385ded34d2e087b86e9735faee49 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Thu, 23 Jul 2026 21:24:53 +0200 Subject: [PATCH] Support authored root functions index Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> --- .github/workflows/Workflow-Test-Default.yml | 41 +++++++++++++++++++ .../workflows/Workflow-Test-WithManifest.yml | 41 +++++++++++++++++++ .../srcTestRepo/src/functions/public/index.md | 10 +++++ .../src/functions/public/index.md | 10 +++++ 4 files changed, 102 insertions(+) create mode 100644 tests/srcTestRepo/src/functions/public/index.md create mode 100644 tests/srcWithManifestTestRepo/src/functions/public/index.md diff --git a/.github/workflows/Workflow-Test-Default.yml b/.github/workflows/Workflow-Test-Default.yml index 511b4b1c..2593a629 100644 --- a/.github/workflows/Workflow-Test-Default.yml +++ b/.github/workflows/Workflow-Test-Default.yml @@ -8,6 +8,7 @@ on: paths: - '.github/actions/**' - '.github/workflows/**' + - 'tests/srcTestRepo/**' - '!.github/workflows/Release.yml' - '!.github/workflows/Linter.yml' schedule: @@ -46,3 +47,43 @@ jobs: ^README\.md$ ^\.github/actions/ ^\.github/workflows/(?!Release\.yml$|Linter\.yml$) + + VerifyRootFunctionsIndexDefault: + name: Verify root Functions index [Default] + runs-on: ubuntu-latest + needs: + - WorkflowTestDefault + steps: + - name: Checkout repo + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Download docs artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: docs + path: tests/srcTestRepo/outputs/docs + + - name: Verify root Functions index is published + shell: pwsh + run: | + $path = 'tests/srcTestRepo/outputs/docs/index.md' + if (-not (Test-Path -Path $path)) { + throw 'Expected root Functions index at tests/srcTestRepo/outputs/docs/index.md.' + } + + $content = Get-Content -Path $path -Raw + $expectedSnippets = @( + 'ms.title: Functions' + '# Functions' + 'This landing page is authored from the root of `src/functions/public`.' + 'Use it to introduce the module''s function surface before readers drill into each group.' + ) + + foreach ($snippet in $expectedSnippets) { + if ($content -notlike "*$snippet*") { + throw "Expected snippet not found in generated root Functions index: $snippet" + } + } diff --git a/.github/workflows/Workflow-Test-WithManifest.yml b/.github/workflows/Workflow-Test-WithManifest.yml index 82f80f55..f7f7563b 100644 --- a/.github/workflows/Workflow-Test-WithManifest.yml +++ b/.github/workflows/Workflow-Test-WithManifest.yml @@ -8,6 +8,7 @@ on: paths: - '.github/actions/**' - '.github/workflows/**' + - 'tests/srcWithManifestTestRepo/**' - '!.github/workflows/Release.yml' - '!.github/workflows/Linter.yml' schedule: @@ -46,3 +47,43 @@ jobs: ^README\.md$ ^\.github/actions/ ^\.github/workflows/(?!Release\.yml$|Linter\.yml$) + + VerifyRootFunctionsIndexWithManifest: + name: Verify root Functions index [WithManifest] + runs-on: ubuntu-latest + needs: + - WorkflowTestWithManifest + steps: + - name: Checkout repo + uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Download docs artifact + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: docs + path: tests/srcWithManifestTestRepo/outputs/docs + + - name: Verify root Functions index is published + shell: pwsh + run: | + $path = 'tests/srcWithManifestTestRepo/outputs/docs/index.md' + if (-not (Test-Path -Path $path)) { + throw 'Expected root Functions index at tests/srcWithManifestTestRepo/outputs/docs/index.md.' + } + + $content = Get-Content -Path $path -Raw + $expectedSnippets = @( + 'ms.title: Functions' + '# Functions' + 'This landing page is authored from the root of `src/functions/public`.' + 'Use it to introduce the module''s function surface before readers drill into each group.' + ) + + foreach ($snippet in $expectedSnippets) { + if ($content -notlike "*$snippet*") { + throw "Expected snippet not found in generated root Functions index: $snippet" + } + } diff --git a/tests/srcTestRepo/src/functions/public/index.md b/tests/srcTestRepo/src/functions/public/index.md new file mode 100644 index 00000000..f92e4da7 --- /dev/null +++ b/tests/srcTestRepo/src/functions/public/index.md @@ -0,0 +1,10 @@ +--- +title: Functions +description: A fully authored landing page for the exported function surface. +--- + +# Functions + +This landing page is authored from the root of `src/functions/public`. + +Use it to introduce the module's function surface before readers drill into each group. diff --git a/tests/srcWithManifestTestRepo/src/functions/public/index.md b/tests/srcWithManifestTestRepo/src/functions/public/index.md new file mode 100644 index 00000000..f92e4da7 --- /dev/null +++ b/tests/srcWithManifestTestRepo/src/functions/public/index.md @@ -0,0 +1,10 @@ +--- +title: Functions +description: A fully authored landing page for the exported function surface. +--- + +# Functions + +This landing page is authored from the root of `src/functions/public`. + +Use it to introduce the module's function surface before readers drill into each group.