@@ -18,24 +18,40 @@ jobs:
1818 - name : Check if build is needed
1919 id : sha256
2020 run : |
21- Set-PSDebug -Trace 1 # Enable verbose output for debugging
21+ Set-PSDebug -Trace 1
2222 try {
2323 $sha256 = (Get-FileHash -Path src/python/rag.py -Algorithm SHA256).Hash
2424 echo "Current SHA256: $sha256"
2525 $previous_sha256 = "${{ github.event.before }}"
26+ echo "Previous SHA256: $previous_sha256"
27+
2628 if ($previous_sha256 -and $previous_sha256 -ne "0000000000000000000000000000000000000000") {
27- $previous_content = git show $previous_sha256:src/python/rag.py 2>$null
28- $LASTEXITCODE = 0 # Reset exit code to avoid propagating git show failure
29- if ($previous_content) {
30- echo $previous_content | Out-File temp_rag.py -Encoding utf8
31- if (Test-Path temp_rag.py) {
32- $previous_hash = (Get-FileHash -Path temp_rag.py -Algorithm SHA256).Hash
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"
34+
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"
3341 if ($previous_hash -eq $sha256) {
3442 echo "No changes detected in rag.py, skipping build and release."
3543 exit 0
44+ } else {
45+ echo "Hash mismatch, proceeding with build."
3646 }
47+ } else {
48+ echo "Failed to create temp_rag.py"
3749 }
50+ } else {
51+ echo "No previous content available, proceeding with build."
3852 }
53+ } else {
54+ echo "No valid previous SHA, proceeding with build."
3955 }
4056 echo "Building new rag.exe due to changes or no previous commit."
4157 } catch {
0 commit comments