Fix issue #5620: [Bug]: Resolver fails when the existing requirements.txt does not end in a newline character (#6327)

This commit is contained in:
OpenHands 2025-01-24 23:36:59 +09:00 committed by GitHub
parent a1f1c802d9
commit c2f308f397
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -84,6 +84,10 @@ jobs:
run: |
python -m pip index versions openhands-ai > openhands_versions.txt
OPENHANDS_VERSION=$(head -n 1 openhands_versions.txt | awk '{print $2}' | tr -d '()')
# Ensure requirements.txt ends with newline before appending
if [ -f requirements.txt ] && [ -s requirements.txt ]; then
sed -i -e '$a\' requirements.txt
fi
echo "openhands-ai==${OPENHANDS_VERSION}" >> requirements.txt
cat requirements.txt