diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8bb50df5..5c5179f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -64,9 +64,18 @@ jobs: if: steps.cache-venv.outputs.cache-hit == 'true' run: | uv sync --group dev + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: skyvern-frontend/package-lock.json + - name: Install frontend dependencies + working-directory: skyvern-frontend + run: npm ci # Finally, run pre-commit. - name: Run all pre-commit hooks - uses: pre-commit/action@v3.0.0 + run: uv run pre-commit run --all-files env: ENABLE_OPENAI: "true" OPENAI_API_KEY: "sk-dummy" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ac8fa6e9..766f16f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,7 +17,7 @@ repos: hooks: - id: check-python-version name: Check Python Version (3.11-3.13) - entry: python -c "import sys; assert (3,11) <= sys.version_info[:2] <= (3,13), f'Python {sys.version_info[:2]} not supported. Use Python 3.11-3.13'" + entry: uv run python -c "import sys; assert (3,11) <= sys.version_info[:2] <= (3,13), f'Python {sys.version_info[:2]} not supported. Use Python 3.11-3.13'" language: system pass_filenames: false always_run: true @@ -105,6 +105,12 @@ repos: types: [javascript] - repo: local hooks: + - id: frontend-precommit + name: Frontend Precommit (lint-staged) + entry: bash -c 'cd skyvern-frontend && npm run precommit' + language: system + files: ^skyvern-frontend/src/ + pass_filenames: false - id: vitest-type-check name: vitest entry: bash -c 'cd skyvern-frontend && ([ -d node_modules ] || npm ci) && npm run test' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0d0714cc..44c66c44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -172,16 +172,21 @@ Updating, improving and correcting the documentation ## Styleguides ### Pre Commit Hooks -Make sure to run the pre-commit hooks before committing your code. -This will help you to automatically format your code and catch cicd failures early. +Make sure to install and run the pre-commit hooks before committing your code. +This will help you to automatically format your code and catch CI/CD failures early. ```bash # Make sure `pre-commit` is installed pip install pre-commit -# Run pre-commit hooks on files in your commit +# Install the git hook scripts (one-time setup) +pre-commit install + +# (Optional) Run pre-commit hooks manually on all files pre-commit run --all-files ``` +Once installed, the hooks will run automatically on `git commit`. + ### Commit Messages