Skip to content

Commit 80f8996

Browse files
rajbosCopilot
andauthored
fix: gate VS extension job and harden marketplace version check in release workflow (#571)
- Add job-level \if\ to \�uild-visualstudio\ so it only runs on tag pushes or when \�s_only == true\; manual VS Code-only releases no longer trigger the expensive VS extension build - Fix null-array panic in the VS Marketplace version check: safely dereference \�xtensions[0]\ before accessing \.versions\, treating a missing extension as a first-publish instead of falling through to the catch block - Change the catch block from warn-and-proceed to hard-fail so a failed Marketplace query can no longer silently allow a duplicate-version publish Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a2c70e5 commit 80f8996

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ jobs:
447447
build-visualstudio:
448448
name: Publish Visual Studio Extension
449449
needs: release
450+
# Only run on tag pushes (to attach vsix to release) or when explicitly building the VS extension
451+
if: github.event_name == 'push' || inputs.vs_only == true
450452
# Windows required: Node.js SEA (bundle-exe.ps1) and MSBuild/VSSDK are Windows-only
451453
runs-on: windows-latest
452454
permissions:
@@ -587,7 +589,12 @@ jobs:
587589
-Uri "https://marketplace.visualstudio.com/_apis/public/gallery/extensionquery?api-version=3.0-preview.1" `
588590
-Headers @{ "Content-Type" = "application/json"; "Accept" = "application/json;api-version=3.0-preview.1" } `
589591
-Body $body
590-
$marketplaceVersion = $r.results[0].extensions[0].versions[0].version
592+
$ext = $r.results[0].extensions[0]
593+
if (-not $ext -or -not $ext.versions) {
594+
Write-Host "⚠️ Extension not found on VS Marketplace — proceeding with first publish."
595+
exit 0
596+
}
597+
$marketplaceVersion = $ext.versions[0].version
591598
if (-not $marketplaceVersion) {
592599
Write-Host "⚠️ Extension not found on VS Marketplace — proceeding with first publish."
593600
exit 0
@@ -599,7 +606,8 @@ jobs:
599606
}
600607
Write-Host "✅ Version check passed: $localVersion is newer than marketplace $marketplaceVersion"
601608
} catch {
602-
Write-Warning "⚠️ Could not query VS Marketplace — proceeding with publish. Error: $_"
609+
Write-Error "❌ Could not query VS Marketplace — aborting to prevent duplicate publish. Error: $_"
610+
exit 1
603611
}
604612
605613
- name: Publish to Visual Studio Marketplace

0 commit comments

Comments
 (0)