5
0
Fork 0
mirror of https://github.com/pre-commit/action.git synced 2025-11-07 10:46:56 +00:00

feat: switch to using uv instead of pip

This commit is contained in:
Matthias Schoettle 2025-02-12 22:29:22 +00:00
parent 576ff52938
commit a8df2899ac
3 changed files with 18 additions and 16 deletions

View file

@ -6,8 +6,14 @@ on:
jobs: jobs:
main: main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-python@v3 - name: Install uv with Python ${{ matrix.python-version }}
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: self test action - name: self test action
uses: ./ uses: ./

View file

@ -1,13 +1,9 @@
this action is in maintenance-only mode and will not be accepting new features. This action is a fork of the [official `pre-commit` action](https://github.com/pre-commit/action).
The only change is that it uses [`uv`](https://docs.astral.sh/uv/) to install `pre-commit`.
generally you want to use [pre-commit.ci] which is faster and has more features.
[pre-commit.ci]: https://pre-commit.ci
___ ___
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/pre-commit/action/main.svg)](https://results.pre-commit.ci/latest/github/pre-commit/action/main) [![.github/workflows/main.yml](https://github.com/mschoettle/pre-commit-action/actions/workflows/main.yml/badge.svg)](https://github.com/mschoettle/pre-commit-action/actions/workflows/main.yml)
[![Build Status](https://github.com/pre-commit/action/actions/workflows/main.yml/badge.svg)](https://github.com/pre-commit/action/actions)
pre-commit/action pre-commit/action
================= =================
@ -31,15 +27,15 @@ jobs:
pre-commit: pre-commit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- uses: actions/setup-python@v3 - uses: astral-sh/setup-uv@v5
- uses: pre-commit/action@v3.0.1 - uses: mschoettle/pre-commit-action@v4.0.0
``` ```
This does a few things: This does a few things:
- clones the code - clones the code
- installs python - installs `uv`
- sets up the `pre-commit` cache - sets up the `pre-commit` cache
### using this action with custom invocations ### using this action with custom invocations
@ -51,7 +47,7 @@ Here's a sample step configuration that only runs the `flake8` hook against all
the files (use the template above except for the `pre-commit` action): the files (use the template above except for the `pre-commit` action):
```yaml ```yaml
- uses: pre-commit/action@v3.0.1 - uses: mschoettle/pre-commit-action@v4.0.0
with: with:
extra_args: flake8 --all-files extra_args: flake8 --all-files
``` ```

View file

@ -8,9 +8,9 @@ inputs:
runs: runs:
using: composite using: composite
steps: steps:
- run: python -m pip install pre-commit - run: uv pip install pre-commit
shell: bash shell: bash
- run: python -m pip freeze --local - run: uv pip freeze
shell: bash shell: bash
- uses: actions/cache@v4 - uses: actions/cache@v4
with: with: