ci(workflows): 修复Windows构建中Git路径和PATH更新的问题
Some checks failed
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Successful in 19m47s
Build Windows / build (push) Failing after 7h0m4s
Build Android APK / 编译 libcore.aar (push) Failing after 8s
Build Android APK / 编译 Android APK (release) (push) Has been skipped
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Failing after 7s
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled

修复Git路径检查使用绝对路径以避免PATH传播时序问题,并确保PATH更新立即生效
This commit is contained in:
shanshanzhong 2025-11-06 03:32:50 -08:00
parent f738ba9245
commit aac7d84602

View File

@ -87,13 +87,22 @@ jobs:
) )
foreach ($p in $paths) { foreach ($p in $paths) {
if (Test-Path $p) { if (Test-Path $p) {
# Make available to subsequent steps
Add-Content -Path $env:GITHUB_PATH -Value $p Add-Content -Path $env:GITHUB_PATH -Value $p
# Also update current step PATH so we can verify immediately
$env:PATH = "$p;$env:PATH"
Write-Host "✅ Added to PATH: $p" Write-Host "✅ Added to PATH: $p"
} else { } else {
Write-Host "⚠️ Path not found: $p" Write-Host "⚠️ Path not found: $p"
} }
} }
git --version # Verify Git using absolute path to avoid PATH propagation timing issues
$gitCmd = 'C:\Program Files\Git\cmd\git.exe'
if (Test-Path $gitCmd) {
& $gitCmd --version
} else {
Write-Host " Git executable not found at $gitCmd; continuing."
}
- name: 📥 Checkout 代码 - name: 📥 Checkout 代码
uses: actions/checkout@v4 uses: actions/checkout@v4