mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 15:48:29 +00:00
70 lines
1.9 KiB
YAML
70 lines
1.9 KiB
YAML
name: Lint
|
|
|
|
on: [pull_request]
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Fetch Target Branch
|
|
run: git fetch origin $TARGET_BRANCH --depth=1
|
|
|
|
- name: Restore global uv cache
|
|
id: cache-restore
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
path: |
|
|
~/.cache/uv
|
|
~/.local/share/uv
|
|
.venv
|
|
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}
|
|
restore-keys: |
|
|
uv-main-py3.11-
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v6
|
|
with:
|
|
version: "0.8.4"
|
|
python-version: "3.11"
|
|
enable-cache: false
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --all-groups --all-extras --no-install-project
|
|
|
|
- name: Get Changed Python Files
|
|
id: changed-files
|
|
run: |
|
|
merge_base=$(git merge-base origin/"$TARGET_BRANCH" HEAD)
|
|
changed_files=$(git diff --name-only --diff-filter=ACMRTUB "$merge_base" | grep '\.py$' || true)
|
|
echo "files<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$changed_files" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Run Ruff on Changed Files
|
|
if: ${{ steps.changed-files.outputs.files != '' }}
|
|
run: |
|
|
echo "${{ steps.changed-files.outputs.files }}" \
|
|
| tr ' ' '\n' \
|
|
| grep -v 'src/crewai/cli/templates/' \
|
|
| grep -v '/tests/' \
|
|
| xargs -I{} uv run ruff check "{}"
|
|
|
|
- name: Save uv caches
|
|
if: steps.cache-restore.outputs.cache-hit != 'true'
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
path: |
|
|
~/.cache/uv
|
|
~/.local/share/uv
|
|
.venv
|
|
key: uv-main-py3.11-${{ hashFiles('uv.lock') }}
|