Skip to content

Commit bbee8c6

Browse files
cirvine-MSFTCopilot
andcommitted
Fix CI failures: PS 5.1 Join-Path compat, isolated HOME per step
- install-extensions.ps1: Use nested Join-Path for PS 5.1 compatibility (2-arg only) - CI: Combine install + verify into single steps so isolated HOME is consistent - CI: Fix pwsh Join-Path calls to use nested 2-arg form Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0892393 commit bbee8c6

2 files changed

Lines changed: 20 additions & 39 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -56,43 +56,31 @@ jobs:
5656
steps:
5757
- uses: actions/checkout@v4
5858

59-
- name: Run bash install script
59+
- name: Run install and verify
6060
run: |
6161
export HOME="$(mktemp -d)"
62-
chmod +x install-extensions.sh
6362
./install-extensions.sh
6463
65-
- name: Verify installed files
66-
run: |
67-
export HOME="$(cat /proc/self/environ | tr '\0' '\n' | grep '^HOME=' | head -1 | cut -d= -f2)"
68-
# Re-run with same isolated HOME
69-
ISOLATED_HOME="$(mktemp -d)"
70-
HOME="$ISOLATED_HOME" ./install-extensions.sh
71-
7264
echo "Checking installed files..."
73-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-pr-watcher/extension.mjs" || { echo "::error::ado-pr-watcher/extension.mjs missing"; exit 1; }
74-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-pr-watcher/common.mjs" || { echo "::error::ado-pr-watcher/common.mjs missing"; exit 1; }
75-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-pr-watcher/integration.mjs" || { echo "::error::ado-pr-watcher/integration.mjs missing"; exit 1; }
76-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-pr-watcher/worker.mjs" || { echo "::error::ado-pr-watcher/worker.mjs missing"; exit 1; }
77-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-build-watcher/extension.mjs" || { echo "::error::ado-build-watcher/extension.mjs missing"; exit 1; }
78-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-build-watcher/common.mjs" || { echo "::error::ado-build-watcher/common.mjs missing"; exit 1; }
79-
test -f "$ISOLATED_HOME/.copilot/extensions/ado-build-watcher/watcher-worker.mjs" || { echo "::error::ado-build-watcher/watcher-worker.mjs missing"; exit 1; }
80-
test -f "$ISOLATED_HOME/.copilot/extensions/lib/tab-indicator.mjs" || { echo "::error::lib/tab-indicator.mjs missing"; exit 1; }
65+
test -f "$HOME/.copilot/extensions/ado-pr-watcher/extension.mjs" || { echo "::error::ado-pr-watcher/extension.mjs missing"; exit 1; }
66+
test -f "$HOME/.copilot/extensions/ado-pr-watcher/common.mjs" || { echo "::error::ado-pr-watcher/common.mjs missing"; exit 1; }
67+
test -f "$HOME/.copilot/extensions/ado-pr-watcher/integration.mjs" || { echo "::error::ado-pr-watcher/integration.mjs missing"; exit 1; }
68+
test -f "$HOME/.copilot/extensions/ado-pr-watcher/worker.mjs" || { echo "::error::ado-pr-watcher/worker.mjs missing"; exit 1; }
69+
test -f "$HOME/.copilot/extensions/ado-build-watcher/extension.mjs" || { echo "::error::ado-build-watcher/extension.mjs missing"; exit 1; }
70+
test -f "$HOME/.copilot/extensions/ado-build-watcher/common.mjs" || { echo "::error::ado-build-watcher/common.mjs missing"; exit 1; }
71+
test -f "$HOME/.copilot/extensions/ado-build-watcher/watcher-worker.mjs" || { echo "::error::ado-build-watcher/watcher-worker.mjs missing"; exit 1; }
72+
test -f "$HOME/.copilot/extensions/lib/tab-indicator.mjs" || { echo "::error::lib/tab-indicator.mjs missing"; exit 1; }
8173
echo "All expected files present"
8274
8375
- name: Verify idempotence (stale files removed)
8476
run: |
85-
ISOLATED_HOME="$(mktemp -d)"
86-
HOME="$ISOLATED_HOME" ./install-extensions.sh
87-
88-
# Create a stale file in one extension dir
89-
touch "$ISOLATED_HOME/.copilot/extensions/ado-pr-watcher/old-stale-file.mjs"
77+
export HOME="$(mktemp -d)"
78+
./install-extensions.sh
9079
91-
# Re-run installer
92-
HOME="$ISOLATED_HOME" ./install-extensions.sh
80+
touch "$HOME/.copilot/extensions/ado-pr-watcher/old-stale-file.mjs"
81+
./install-extensions.sh
9382
94-
# Stale file should be gone
95-
if [ -f "$ISOLATED_HOME/.copilot/extensions/ado-pr-watcher/old-stale-file.mjs" ]; then
83+
if [ -f "$HOME/.copilot/extensions/ado-pr-watcher/old-stale-file.mjs" ]; then
9684
echo "::error::Stale file survived reinstall — installer is not idempotent"
9785
exit 1
9886
fi
@@ -104,13 +92,7 @@ jobs:
10492
steps:
10593
- uses: actions/checkout@v4
10694

107-
- name: Run PowerShell install script
108-
shell: pwsh
109-
run: |
110-
$env:HOME = (New-Item -ItemType Directory -Path (Join-Path ([System.IO.Path]::GetTempPath()) "copilot-test-$(Get-Random)")).FullName
111-
./install-extensions.ps1
112-
113-
- name: Verify installed files
95+
- name: Run install and verify
11496
shell: pwsh
11597
run: |
11698
$isolatedHome = (New-Item -ItemType Directory -Path (Join-Path ([System.IO.Path]::GetTempPath()) "copilot-test-$(Get-Random)")).FullName
@@ -127,7 +109,7 @@ jobs:
127109
"ado-build-watcher/watcher-worker.mjs",
128110
"lib/tab-indicator.mjs"
129111
)
130-
$extDir = Join-Path $isolatedHome ".copilot" "extensions"
112+
$extDir = Join-Path (Join-Path $isolatedHome ".copilot") "extensions"
131113
$missing = $expected | Where-Object { -not (Test-Path (Join-Path $extDir $_)) }
132114
if ($missing) {
133115
$missing | ForEach-Object { Write-Error "Missing: $_" }
@@ -142,11 +124,10 @@ jobs:
142124
$env:HOME = $isolatedHome
143125
./install-extensions.ps1
144126
145-
# Create stale file
146-
$stale = Join-Path $isolatedHome ".copilot" "extensions" "ado-pr-watcher" "old-stale-file.mjs"
127+
$prDir = Join-Path (Join-Path (Join-Path $isolatedHome ".copilot") "extensions") "ado-pr-watcher"
128+
$stale = Join-Path $prDir "old-stale-file.mjs"
147129
"" | Set-Content $stale
148130
149-
# Reinstall
150131
./install-extensions.ps1
151132
152133
if (Test-Path $stale) {
@@ -178,7 +159,7 @@ jobs:
178159
"ado-build-watcher\watcher-worker.mjs",
179160
"lib\tab-indicator.mjs"
180161
)
181-
$extDir = Join-Path $isolatedHome.FullName ".copilot" "extensions"
162+
$extDir = Join-Path (Join-Path $isolatedHome.FullName ".copilot") "extensions"
182163
$missing = $expected | Where-Object { -not (Test-Path (Join-Path $extDir $_)) }
183164
if ($missing) {
184165
$missing | ForEach-Object { Write-Error "Missing: $_" }

install-extensions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ $ErrorActionPreference = "Stop"
55

66
$repoRoot = $PSScriptRoot
77
$sourceDir = Join-Path $repoRoot "extensions"
8-
$targetDir = Join-Path $HOME ".copilot" "extensions"
8+
$targetDir = Join-Path (Join-Path $HOME ".copilot") "extensions"
99

1010
if (-not (Test-Path $sourceDir)) {
1111
Write-Error "extensions/ directory not found at '$sourceDir'. Run this script from the repo root."

0 commit comments

Comments
 (0)