Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix - #2311
Fix: DownloadRelease incorrectly matches release assets from projects with the same name prefix#2311spetersenms with Copilot wants to merge 3 commits into
Conversation
… matches for projects with same name prefix
spetersenms
left a comment
There was a problem hiding this comment.
@copilot you only made changes to tests, no actual functionality? Can we detect if multiple environments would match and throw a warning if that is the case?
You're right — only tests were added previously since the regex with I've now added the ambiguity detection in This fires whether or not any assets were matched, so users also get a helpful hint when no assets download due to a naming collision. The wildcard |
| finally { | ||
| Remove-Item -Path $tempPath -Recurse -Force -ErrorAction SilentlyContinue | ||
| } | ||
| } |
| finally { | ||
| Remove-Item -Path $tempPath -Recurse -Force -ErrorAction SilentlyContinue | ||
| } | ||
| } |
When locating previous release assets, the glob pattern
logis-interface-*-Apps-*.zipmatched assets fromlogis-interface-2-core-librarybecause*spans hyphens. This caused unrelated projects' apps to be used as the previous release baseline.Fix
DownloadReleaseinActions/Github-Helper.psm1already uses regex patterns with[^-]+for the branch segment instead of glob wildcards:[^-]+prevents the branch segment from spanning hyphen-separated project name components, sologis-interface-[^-]+-Apps-.+\.zip$correctly rejectslogis-interface-2-core-library-main-Apps-1.0.64.0.zip.Tests
Added regression tests in
Tests/GitHub-Helper.Test.ps1covering:logis-interfacedownloads only its own assets, notlogis-interface-2-core-libraryassets (the reported scenario)logis-interface-2-core-libraryresolves its own assets independently*project still matches all assets✅ Checklist