ci(workflow): 修复 git extraheader 配置并添加 jq 安装检查
Some checks failed
Build Windows / ACT Windows Checkout Verification (push) Failing after 7h0m13s
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Failing after 15s
Build Windows / build (push) Has been skipped

移除 git 配置中的 extraheader 以避免潜在问题
添加 jq 安装检查并在缺失时通过 Chocolatey 安装
This commit is contained in:
shanshanzhong 2025-11-07 04:50:51 -08:00
parent fed0b0e422
commit 577327c40a

View File

@ -30,6 +30,20 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: 🔧 Fix Git Extra Header
shell: powershell
run: |
# 移除可能的 extraheader 配置,包括带 %0A 的变体
git config --global --unset-all http.https://git.kxsw.us/.extraheader
git config --global --unset-all http."https://git.kxsw.us/".extraheader
git config --global --unset-all http.https://git.kxsw.us/.extraheader%0A
git config --global --unset-all http."https://git.kxsw.us/".extraheader%0A
# 对于 submodule
git submodule foreach --recursive "git config --local --unset-all http.https://git.kxsw.us/.extraheader || true"
git submodule foreach --recursive "git config --local --unset-all http.https://git.kxsw.us/.extraheader%0A || true"
# 验证
git config --global --get-regexp http.*.extraheader || echo "No extraheader found"
- name: 🔧 设置 Go 环境
uses: actions/setup-go@v5
with:
@ -222,6 +236,64 @@ jobs:
assets/translations
sparse-checkout-cone: true
- name: 🔧 Fix Git Extra Header (ACT)
shell: powershell
run: |
# 移除可能的 extraheader 配置,包括带 %0A 的变体
git config --global --unset-all http.https://git.kxsw.us/.extraheader
git config --global --unset-all http."https://git.kxsw.us/".extraheader
git config --global --unset-all http.https://git.kxsw.us/.extraheader%0A
git config --global --unset-all http."https://git.kxsw.us/".extraheader%0A
# 对于 submodule
git submodule foreach --recursive "git config --local --unset-all http.https://git.kxsw.us/.extraheader || true"
git submodule foreach --recursive "git config --local --unset-all http.https://git.kxsw.us/.extraheader%0A || true"
# 验证
git config --global --get-regexp http.*.extraheader || echo "No extraheader found"
- name: 🔍 Verify jq Installation (ACT)
shell: powershell
run: |
# 检查 jq 是否可用
$jqFound = $false
try {
$version = jq --version 2>&1
if ($version -match 'jq-[\d\.]+') {
Write-Host "✅ jq 已安装: $version"
$jqFound = $true
}
} catch {
Write-Host "❌ jq 未安装或不在 PATH 中"
}
if (-not $jqFound) {
Write-Host "⚠️ 准备安装 jq..."
# 检查 Chocolatey 是否可用
$chocoFound = $false
try {
choco --version 2>&1 | Out-Null
$chocoFound = $true
} catch {}
if (-not $chocoFound) {
Write-Host "📦 安装 Chocolatey..."
Set-ExecutionPolicy Bypass -Scope Process -Force
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# 刷新 PATH
$env:PATH = [System.Environment]::GetEnvironmentVariable("PATH", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("PATH", "User")
Write-Host "✅ Chocolatey 安装完成"
}
Write-Host "📦 使用 Chocolatey 安装 jq..."
choco install jq -y
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ jq 安装成功"
# 再次验证
$version = jq --version 2>&1
Write-Host "✅ jq 版本: $version"
} else {
Write-Host "❌ jq 安装失败,退出码: $LASTEXITCODE"
exit 1
}
}
- name: Verify submodules
shell: powershell
continue-on-error: true