pre-commit/action

Disabling hooks by id

Closed this issue · 2 comments

Hello, the SKIP environment variable can be set to disable pre-commit hooks, but I could not make it work with this action. Is it possible to disable hooks by id with this action? If not, could this be added? I can help if necessary.

how do you set environment variables in github ?

Hello, I tried with - run: SKIP=ruff,ruff-format, but it did not work. However, I read a bit more about environment variables with GitHub and setting SKIP in env: does work!

name: Pre-commit hooks

on: [push]

env:
  SKIP: ruff,ruff-format

jobs:
  pre-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.10"
      - uses: pre-commit/action@v3.0.1

I think this closes the issue, even though the variable name SKIP might clash with some other tool (in my case it does not). This recipe might be worth adding somewhere as an example.