diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01c704aa..5c6823b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: timeout-minutes: 20 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: fetch-depth: 0 ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.ref || github.ref }} @@ -51,12 +51,19 @@ jobs: git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add PSWriteHTML.psd1 - git commit -m "chore: regenerate psd1" || echo "No changes to commit" - git push origin HEAD:$Env:HEAD_BRANCH + git diff --cached --quiet + if ($LASTEXITCODE -eq 0) { + Write-Host "No PSD1 changes to commit." + } elseif ($LASTEXITCODE -eq 1) { + git commit -m "chore: regenerate psd1" + git push origin HEAD:$Env:HEAD_BRANCH + } else { + throw "Unable to inspect staged PSD1 changes (git exit code $LASTEXITCODE)." + } shell: pwsh - name: Upload refreshed manifest - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: psd1 path: PSWriteHTML.psd1 @@ -68,10 +75,10 @@ jobs: timeout-minutes: 20 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download manifest - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: psd1 path: . @@ -94,10 +101,10 @@ jobs: timeout-minutes: 20 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download manifest - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: psd1 path: . @@ -120,10 +127,10 @@ jobs: timeout-minutes: 20 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download manifest - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: psd1 path: . @@ -153,10 +160,10 @@ jobs: timeout-minutes: 20 steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Download manifest - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v8 with: name: psd1 path: .