-
-
Notifications
You must be signed in to change notification settings - Fork 15
45 lines (39 loc) · 1.41 KB
/
check-pip-compile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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