From 136ea2c6940a6f4c06be93e9515c0d5f3cf9cd3c Mon Sep 17 00:00:00 2001 From: Valentina Vecchio Date: Sat, 5 Apr 2025 16:05:34 +0100 Subject: [PATCH] Add pre-commit action --- .github/workflows/jekyll-gh-pages.yml | 2 +- .github/workflows/pre-commit.yml | 18 ++++++++++++++++++ .pre-commit-config.yaml | 13 +++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index 37ff2fc..06f9972 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -28,7 +28,7 @@ jobs: run-python: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..ff1548a --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,18 @@ +name: pre-commit + +on: + pull_request: + push: + branches: ["main"] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get pre-commit + uses: pre-commit/action@v3.0.0 + - name: Run pre-commit + run: pre-commit run --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..4cf4211 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,13 @@ +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: check-json + - id: check-yaml + - id: trailing-whitespace + - id: end-of-file-fixer +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.4 + hooks: + - id: ruff + - id: ruff-format