Merge pull request 'Sit' (#22) from sit into prod
Reviewed-on: http://wcy111.top:3000/xiaowang/JayuCloud/pulls/22
This commit was merged in pull request #22.
This commit is contained in:
@@ -14,6 +14,8 @@ jobs:
|
||||
github.event.pull_request.base.ref == 'prod' &&
|
||||
github.event.pull_request.head.ref == 'sit'
|
||||
runs-on: jayucloud
|
||||
env:
|
||||
GITHUB_REF_NAME: prod
|
||||
steps:
|
||||
- name: 检出合并提交
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -475,8 +475,16 @@ function Invoke-RemoteShellMany {
|
||||
function Test-GitState {
|
||||
Push-Location $resolvedRepoRoot
|
||||
try {
|
||||
$commit = (& git rev-parse HEAD).Trim()
|
||||
$branch = (& git branch --show-current).Trim()
|
||||
$commitOutput = & git rev-parse HEAD
|
||||
if ($LASTEXITCODE -ne 0 -or $null -eq $commitOutput) {
|
||||
throw "无法读取当前 Git 提交号。"
|
||||
}
|
||||
$commit = ([string]$commitOutput).Trim()
|
||||
$branchOutput = & git branch --show-current
|
||||
$branch = if ($null -ne $branchOutput) { ([string]$branchOutput).Trim() } else { "" }
|
||||
if (-not $branch) {
|
||||
$branch = if ($env:GITHUB_REF_NAME) { ([string]$env:GITHUB_REF_NAME).Trim() } else { "DETACHED_HEAD" }
|
||||
}
|
||||
$status = @(& git status --porcelain)
|
||||
if ($status.Count -gt 0) {
|
||||
Write-Warning "当前工作区有 $($status.Count) 个变更路径。"
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# 项目变更记录
|
||||
|
||||
## 2026-08-28 修复 Gitea Detached HEAD 构建失败
|
||||
|
||||
- 修复 Gitea Actions 检出合并提交后处于 detached HEAD,`git branch --show-current` 返回空值导致 PowerShell `.Trim()` 空引用异常的问题。
|
||||
- `Test-GitState` 现在在 CI 中使用 `GITHUB_REF_NAME` 作为分支名,并在本地 detached HEAD 场景使用明确的 `DETACHED_HEAD` 标识。
|
||||
- Salon 生产准备工作流显式设置 `GITHUB_REF_NAME=prod`,保持合并提交构建行为不变。
|
||||
|
||||
## 2026-08-27 Gitea Runner 构建工具链修复
|
||||
|
||||
- 修复 `jayucloud` Runner 任务容器缺少 `pwsh` 导致 Salon 发布包构建失败的问题。
|
||||
|
||||
Reference in New Issue
Block a user