@@ -18,23 +18,31 @@ jobs:
1818 - name : Check if build is needed
1919 id : sha256
2020 run : |
21- $sha256 = (Get-FileHash -Path src/python/rag.py -Algorithm SHA256).Hash
22- echo "Current SHA256: $sha256"
23- $previous_sha256 = "${{ github.event.before }}"
24- if ($previous_sha256 -and $previous_sha256 -ne "0000000000000000000000000000000000000000") {
25- $previous_content = git show $previous_sha256:src/python/rag.py 2>$null
26- if ($?) {
27- echo $previous_content | Out-File temp_rag.py -Encoding utf8
28- $previous_hash = (Get-FileHash -Path temp_rag.py -Algorithm SHA256).Hash
29- if ($previous_hash -eq $sha256) {
30- echo "No changes detected in rag.py, skipping build and release."
31- Remove-Item -Path temp_rag.py -Force -ErrorAction SilentlyContinue
32- exit 0
21+ Set-PSDebug -Trace 1 # Enable verbose output for debugging
22+ try {
23+ $sha256 = (Get-FileHash -Path src/python/rag.py -Algorithm SHA256).Hash
24+ echo "Current SHA256: $sha256"
25+ $previous_sha256 = "${{ github.event.before }}"
26+ if ($previous_sha256 -and $previous_sha256 -ne "0000000000000000000000000000000000000000") {
27+ $previous_content = git show $previous_sha256:src/python/rag.py 2>$null
28+ if ($? -and $previous_content) {
29+ echo $previous_content | Out-File temp_rag.py -Encoding utf8
30+ if (Test-Path temp_rag.py) {
31+ $previous_hash = (Get-FileHash -Path temp_rag.py -Algorithm SHA256).Hash
32+ if ($previous_hash -eq $sha256) {
33+ echo "No changes detected in rag.py, skipping build and release."
34+ exit 0
35+ }
36+ }
3337 }
3438 }
39+ echo "Building new rag.exe due to changes or no previous commit."
40+ } catch {
41+ echo "Error in hash comparison: $_"
42+ exit 1
43+ } finally {
44+ Remove-Item -Path temp_rag.py -Force -ErrorAction SilentlyContinue
3545 }
36- Remove-Item -Path temp_rag.py -Force -ErrorAction SilentlyContinue
37- echo "Building new rag.exe due to changes or no previous commit."
3846 shell : pwsh
3947
4048 # Set up Python
0 commit comments