From 6bacea6f87c70379d63b69f19da98355b50a209d Mon Sep 17 00:00:00 2001 From: Neil <49037171+neilr81@users.noreply.github.com> Date: Mon, 13 Apr 2026 15:51:21 +0100 Subject: [PATCH] Optimize package update workflow to skip commits if no changes Adding more robust check if no changes are present for Package Updates. --- .github/workflows/package-update.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/package-update.yml b/.github/workflows/package-update.yml index 04069983..80885b29 100644 --- a/.github/workflows/package-update.yml +++ b/.github/workflows/package-update.yml @@ -44,15 +44,16 @@ jobs: git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - git checkout -b $branch - git add -A - - if (git diff --cached --quiet) { + $ChangedFilesCount = $(git status --porcelain | Measure-Object | Select-Object -expand Count) + if ($ChangedFilesCount -eq 0) { Write-Host "No changes detected; skipping commit and PR creation." "has-changes=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8 exit 0 } + git checkout -b $branch + git add -A + git commit -m "chore(automation): update NuGet packages and .NET SDK versions" if ($LASTEXITCODE -ne 0) { Write-Error "git commit failed with exit code $LASTEXITCODE."