mirror of
https://github.com/EvolutionAPI/adk-python.git
synced 2025-12-24 06:07:44 -06:00
60 lines
1.5 KiB
YAML
60 lines
1.5 KiB
YAML
name: Check Pyink Formatting
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- 'src/**/*.py'
|
|
- 'tests/**/*.py'
|
|
- 'pyproject.toml'
|
|
|
|
jobs:
|
|
pyink-check:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.x'
|
|
|
|
- name: Install pyink
|
|
run: |
|
|
pip install pyink
|
|
|
|
- name: Detect changed Python files
|
|
id: detect_changes
|
|
run: |
|
|
git fetch origin ${{ github.base_ref }}
|
|
CHANGED_FILES=$(git diff --diff-filter=ACMR --name-only origin/${{ github.base_ref }}...HEAD | grep -E '\.py$' || true)
|
|
echo "CHANGED_FILES=${CHANGED_FILES}" >> $GITHUB_ENV
|
|
|
|
- name: Run pyink on changed files
|
|
if: env.CHANGED_FILES != ''
|
|
run: |
|
|
echo "Changed Python files:"
|
|
echo "$CHANGED_FILES"
|
|
|
|
# Run pyink --check
|
|
set +e
|
|
pyink --check --config pyproject.toml $CHANGED_FILES
|
|
RESULT=$?
|
|
set -e
|
|
|
|
if [ $RESULT -ne 0 ]; then
|
|
echo ""
|
|
echo "❌ Pyink formatting check failed!"
|
|
echo "👉 To fix formatting, run locally:"
|
|
echo ""
|
|
echo " pyink --config pyproject.toml $CHANGED_FILES"
|
|
echo ""
|
|
exit $RESULT
|
|
fi
|
|
|
|
- name: No changed Python files detected
|
|
if: env.CHANGED_FILES == ''
|
|
run: |
|
|
echo "No Python files changed. Skipping pyink check."
|