Skip to content

ci: fix wrong env

ci: fix wrong env #46

name: Check pip compile sync
on: [push, pull_request]
jobs:
check-pip-compile:
name: Check pip compile
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: pyproject.toml
- name: Install uv
run: |
pip3 install uv
- name: Generate lockfile and print diff
run: |
set +e # Do not exit shell on failure
out=$(bash scripts/compile_requirements.sh 2> _stderr.txt)
exit_code=$?
err=$(<_stderr.txt)
if [[ -n "$out" ]]; then
# Display the raw output in the step
echo "${out}"
# Display the Markdown output in the job summary
{ echo "\`\`\`"; echo "${out}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ -n "$err" ]]; then
echo "${err}"
{ echo "\`\`\`"; echo "${err}"; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
fi
if [[ $exit_code -eq 0 ]]; then
# When the script fails, there are changes in requirements that are not compiled yet.
# Print the suggested changes.
{ echo "\`\`\`diff"; git diff; echo "\`\`\`"; } >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
# When the script fails, it means it does not have anything to compile.
exit 0