mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-08 12:08:15 +00:00
Ruff fails when checking .py files in the templates directory because
it discovers the nearby pyproject.toml which contains {{folder_name}}
placeholders that are invalid TOML. Add the new template path to the
CI grep filter, matching the existing exclusion for the original path.
71 lines
2.0 KiB
YAML
71 lines
2.0 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 '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') }}
|