Skip to content

Commit 734eead

Browse files
committed
fix: 构建加log
1 parent 66c0a4c commit 734eead

File tree

1 file changed

+26
-17
lines changed

1 file changed

+26
-17
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,29 +26,38 @@ jobs:
2626
echo "Previous SHA256: $previous_sha256"
2727
2828
if ($previous_sha256 -and $previous_sha256 -ne "0000000000000000000000000000000000000000") {
29-
$previous_content = git show $previous_sha256:src/python/rag.py 2>&1
30-
$git_exit_code = $LASTEXITCODE
31-
$LASTEXITCODE = 0
32-
echo "Git show exit code: $git_exit_code"
33-
echo "Git show output: $previous_content"
29+
$rag_path = "src/python/rag.py" -replace '\\', '/'
30+
echo "Checking if $rag_path exists in $previous_sha256"
31+
$file_exists = git cat-file -e "$previous_sha256:$rag_path" 2>$null
32+
$check_exit_code = $LASTEXITCODE
3433
35-
if ($previous_content -and $git_exit_code -eq 0) {
36-
$tempFile = Join-Path $PWD "temp_rag.py"
37-
echo $previous_content | Out-File $tempFile -Encoding utf8NoBOM
38-
if (Test-Path $tempFile) {
39-
$previous_hash = (Get-FileHash -Path $tempFile -Algorithm SHA256).Hash
40-
echo "Previous SHA256: $previous_hash"
41-
if ($previous_hash -eq $sha256) {
42-
echo "No changes detected in rag.py, skipping build and release."
43-
exit 0
34+
if ($check_exit_code -eq 0) {
35+
$previous_content = git show "$previous_sha256:$rag_path" -- 2>&1
36+
$git_exit_code = $LASTEXITCODE
37+
$LASTEXITCODE = 0
38+
echo "Git show exit code: $git_exit_code"
39+
echo "Git show output: $previous_content"
40+
41+
if ($previous_content -and $git_exit_code -eq 0) {
42+
$tempFile = Join-Path $PWD "temp_rag.py"
43+
echo $previous_content | Out-File $tempFile -Encoding utf8NoBOM
44+
if (Test-Path $tempFile) {
45+
$previous_hash = (Get-FileHash -Path $tempFile -Algorithm SHA256).Hash
46+
echo "Previous SHA256: $previous_hash"
47+
if ($previous_hash -eq $sha256) {
48+
echo "No changes detected in rag.py, skipping build and release."
49+
exit 0
50+
} else {
51+
echo "Hash mismatch, proceeding with build."
52+
}
4453
} else {
45-
echo "Hash mismatch, proceeding with build."
54+
echo "Failed to create temp_rag.py"
4655
}
4756
} else {
48-
echo "Failed to create temp_rag.py"
57+
echo "Failed to retrieve previous content, proceeding with build."
4958
}
5059
} else {
51-
echo "No previous content available, proceeding with build."
60+
echo "src/python/rag.py does not exist in commit $previous_sha256, proceeding with build."
5261
}
5362
} else {
5463
echo "No valid previous SHA, proceeding with build."

0 commit comments

Comments
 (0)