@@ -51,14 +51,11 @@ jobs:
5151 $singleDepName = ""
5252 $singleDepOldVersion = ""
5353 $singleDepNewVersion = ""
54- $updatedCount = 0
5554 foreach ($s in $newVersion) {
5655 $oldVersion = ($currentVersion | Where-Object {$_.name -eq $s.name}).version
5756 if ($s.version -ne $oldVersion) {
5857 $repoUrl = ($repoUrl = $s.Url.Replace("/archive/", "/releases/")).Substring(0, $repoUrl.IndexOf("/releases/")) + "/releases"
5958
60- $updatedCount++
61-
6259 # Store single dependency info for messages (only if this is the only update)
6360 if ($count -eq 1) {
6461 $singleDepName = $s.name
@@ -122,11 +119,19 @@ jobs:
122119 }
123120 if ($count -eq 0) { return }
124121 Set-GHVariable -Name LIST_UPDATED -Value $listUpdated.Trim(', ')
125- # Ensure single dependency variables are set (use placeholder if empty)
126- if ([string]::IsNullOrEmpty($singleDepName)) {
127- $singleDepName = "dependency"
122+ # Set single dependency variables (they will only be used if COUNT_UPDATED is 1)
123+ # Use safe fallback values in case variables weren't set (shouldn't happen but prevents errors)
124+ if ([string]::IsNullOrEmpty($singleDepName) -and $count -eq 1) {
125+ # This shouldn't happen, but if it does, log a warning
126+ Write-Warning "Single dependency name not set despite count being 1"
127+ $singleDepName = "unknown-package"
128128 $singleDepOldVersion = "unknown"
129129 $singleDepNewVersion = "unknown"
130+ } elseif ([string]::IsNullOrEmpty($singleDepName)) {
131+ # For multiple dependencies, set placeholder values (won't be used)
132+ $singleDepName = ""
133+ $singleDepOldVersion = ""
134+ $singleDepNewVersion = ""
130135 }
131136 Set-GHVariable -Name SINGLE_DEP_NAME -Value $singleDepName
132137 Set-GHVariable -Name SINGLE_DEP_OLD_VERSION -Value $singleDepOldVersion
0 commit comments