Skip to content

Commit 1dd8e33

Browse files
committed
Align release lint checks with CI
1 parent ff2ac7f commit 1dd8e33

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
2224

2325
- name: Install release dependencies
2426
run: |
@@ -36,18 +38,35 @@ jobs:
3638
exit 1
3739
fi
3840
41+
- name: Get changed Python files
42+
id: changed
43+
run: |
44+
FILES=$(git diff --name-only --diff-filter=ACM HEAD~1...HEAD -- '*.py' | grep '^trpc_agent_sdk/' || true)
45+
if [ -z "$FILES" ]; then
46+
echo "has_files=false" >> "$GITHUB_OUTPUT"
47+
else
48+
echo "has_files=true" >> "$GITHUB_OUTPUT"
49+
echo "$FILES" > "$RUNNER_TEMP/changed_py_files.txt"
50+
echo "Changed Python files:"
51+
echo "$FILES"
52+
fi
53+
3954
- name: Check formatting with YAPF
55+
if: steps.changed.outputs.has_files == 'true'
4056
run: |
41-
diff_output=$(yapf --diff --recursive trpc_agent_sdk) || true
57+
FILES=$(cat "$RUNNER_TEMP/changed_py_files.txt" | tr '\n' ' ')
58+
diff_output=$(yapf --diff $FILES) || true
4259
if [ -n "$diff_output" ]; then
4360
echo "$diff_output"
44-
echo "::error::Code formatting check failed. Run 'yapf -i -r trpc_agent_sdk' to fix."
61+
echo "::error::Code formatting check failed for changed files. Run 'yapf -i <file>' to fix."
4562
exit 1
4663
fi
4764
4865
- name: Lint with flake8
66+
if: steps.changed.outputs.has_files == 'true'
4967
run: |
50-
flake8 trpc_agent_sdk
68+
FILES=$(cat "$RUNNER_TEMP/changed_py_files.txt" | tr '\n' ' ')
69+
flake8 $FILES
5170
5271
- name: Run tests with coverage
5372
run: |

0 commit comments

Comments
 (0)