diff --git a/.github/workflows/pull_request_create.yml b/.github/workflows/pull_request_create.yml index daf9cad..988fc94 100644 --- a/.github/workflows/pull_request_create.yml +++ b/.github/workflows/pull_request_create.yml @@ -7,8 +7,11 @@ on: - synchronize jobs: - test: + test-module: runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write steps: - name: Checkout repository @@ -60,15 +63,25 @@ jobs: Write-Output "✓ All $($exportedFunctions.Count) exported functions have corresponding markdown files" - - name: Test XML Help Generation + - name: Generate XML Help + shell: pwsh + run: New-ExternalHelp -Path ".\docs" -OutputPath "." -Force + + - name: Commit and Push Help Updates shell: pwsh run: | - New-ExternalHelp -Path ".\docs" -OutputPath ".\test-help" -Force - if (-not (Test-Path ".\test-help\PowerAzPlus-help.xml")) { - Write-Error "Failed to generate help XML" - exit 1 + git config user.email "github-actions@github.com" + git config user.name "GitHub Actions" + git fetch origin ${{ github.head_ref }} + git checkout ${{ github.head_ref }} + git add PowerAzPlus-help.xml + if (!(git diff --cached --quiet)) { + git commit -m "update help documentation" + git push origin ${{ github.head_ref }} + } else { + Write-Host "No changes to help file" } - Write-Output "Help XML generated successfully" + continue-on-error: true - name: Test publish to PowerShell Gallery shell: pwsh diff --git a/.github/workflows/pull_request_merge.yml b/.github/workflows/pull_request_merge.yml index 3240fdf..e39b16c 100644 --- a/.github/workflows/pull_request_merge.yml +++ b/.github/workflows/pull_request_merge.yml @@ -13,25 +13,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install PlatyPS - shell: pwsh - run: Install-Module -Name PlatyPS -Force -Scope CurrentUser - - - name: Generate XML Help - shell: pwsh - run: New-ExternalHelp -Path ".\docs" -OutputPath "." -Force - - - name: Commit and Push Help Updates - shell: pwsh - run: | - git config user.email "github-actions@github.com" - git config user.name "GitHub Actions" - git add PowerAzPlus-help.xml - git commit -m "chore: update help documentation" || echo "No changes to help file" - git push - name: Publish module to PowerShell Gallery shell: pwsh