build: check exit code without causing script to fail (#1447)

A bug in the CI script caused the entire script to fail if the exit code
of the command for comparing with the existing hash returned a non-zero
exit status.  The non-zero exit status for this comparison does not
imply failed execution, since it only indicates that the hash has
changed.
pull/1450/head
Ashay Rane 2022-10-02 16:04:26 -05:00 committed by GitHub
parent 855d267c57
commit 005d40f4d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -34,8 +34,8 @@ jobs:
python -m pip download -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre "torch==${PT_RELEASE}"
# Read the commit hash from the downloaded whl file without extracting it
PT_HASH=$(unzip -p torch-"${PT_RELEASE}"*.whl torch/version.py | grep git_version | awk '{ print $3 }' | tr -d "'")
echo "${PT_HASH}" | cmp - pytorch-version.txt --quiet
PT_HASH_CHANGED=$?
PT_HASH_CHANGED=0
echo "${PT_HASH}" | cmp - pytorch-version.txt --quiet || PT_HASH_CHANGED=$?
echo "${PT_HASH}" > pytorch-version.txt
rm torch-"${PT_RELEASE}"*.whl
# Write the release and hash to the environment file so that we can