Skip to content

Commit f14a7c6

Browse files
committed
Fix powershell issues
1 parent e2a6cfe commit f14a7c6

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
"/^(&\\s+)?git\\s+(worktree\\s+list|remote(\\s+(-v|show))?|config\\s+--get)(?!.*[;&|<>])/": true,
4141
"/^(&\\s+)?git\\s+stash(\\s+(push|apply|pop|list|show|drop|branch)(\\s+[^;&|<>]+)*)?(?!.*[;&|<>])/": true,
4242

43+
// GitHub CLI read-only operations only
44+
// Explicitly allow read verbs (view/list/status/search) and block chained/redirection patterns.
45+
"/^(&\\s+)?gh\\s+(pr|issue|repo|run|release|workflow|label|milestone|project|discussion|gist)\\s+(view|list|status)\\b(?!.*[;&|<>])/i": true,
46+
"/^(&\\s+)?gh\\s+search\\s+(prs|issues|repos|commits|code)\\b(?!.*[;&|<>])/i": true,
47+
// gh api is approved only when no explicit mutating method is specified.
48+
"/^(&\\s+)?gh\\s+api\\b(?!.*\\s(-X|--method)\\s*(POST|PUT|PATCH|DELETE)\\b)(?!.*[;&|<>])/i": true,
49+
4350
// Python/scripting (consolidated)
4451
"/^(&\\s+)?python\\s+(scripts\\/|-m|\\.github\\/)(?!.*[;&|<>])/": true,
4552
"/^(&\\s+)?\\.[\\\\/]scripts[\\\\/](?!.*[;&|<>])/": true,

Build/Agent/FwBuildHelpers.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function Stop-ConflictingProcesses {
128128
function Get-WorktreeMutexName {
129129
param([Parameter(Mandatory)][string]$RepoRoot)
130130

131-
$normalizedRepoRoot = [System.IO.Path]::GetFullPath($RepoRoot).TrimEnd('\\', '/')
131+
$normalizedRepoRoot = [System.IO.Path]::GetFullPath($RepoRoot).TrimEnd('\', '/')
132132
$normalizedRepoRoot = $normalizedRepoRoot.ToLowerInvariant()
133133

134134
$bytes = [System.Text.Encoding]::UTF8.GetBytes($normalizedRepoRoot)
@@ -142,7 +142,7 @@ function Get-WorktreeMutexName {
142142

143143
$hash = [System.BitConverter]::ToString($hashBytes).Replace('-', '')
144144
$shortHash = $hash.Substring(0, 16)
145-
return "Global\\FieldWorks.Worktree.$shortHash"
145+
return "Global\FieldWorks.Worktree.$shortHash"
146146
}
147147

148148
function Enter-WorktreeLock {
@@ -178,7 +178,7 @@ function Enter-WorktreeLock {
178178
$hasHandle = $true
179179
}
180180

181-
$lockPath = Join-Path $RepoRoot "Output\\WorktreeRun.lock.json"
181+
$lockPath = Join-Path $RepoRoot 'Output' | Join-Path -ChildPath 'WorktreeRun.lock.json'
182182

183183
if (-not $hasHandle) {
184184
$ownerDetails = $null

0 commit comments

Comments
 (0)