From 0012d7b936c821f076cfa05e2928ffc93bbabd0a Mon Sep 17 00:00:00 2001 From: Nicola Sella Date: Thu, 9 Nov 2023 16:48:57 +0100 Subject: [PATCH] Add pre-commit checks --- .github/workflows/pre-commit.yml | 21 +++++++++++++++++++++ .pre-commit-config.yaml | 17 +++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..0a15ae7a7 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,21 @@ +--- +name: Pre Commit +on: + pull_request: + merge_group: + types: [checks_requested] + + +jobs: + pre-commit: + name: Pre Commit Hooks + runs-on: ubuntu-latest + container: ghcr.io/rpm-software-management/dnf-ci-host + steps: + - uses: actions/checkout@v3 + - name: Install pre-commit + run: pip install pre-commit + - name: State to use Workspace Dir + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Run pre-commit on entire codebase + run: pre-commit run --show-diff-on-failure --color=always --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..55642acfb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,17 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.2.0 + hooks: + - id: check-added-large-files + - id: check-merge-conflict + # Passes if packit not installed. Needed for validation locally +- repo: https://github.com/packit/pre-commit-hooks + rev: v1.2.0 + hooks: + - id: validate-config +- repo: https://github.com/teemtee/tmt.git + rev: 1.26.0 + hooks: + - id: tmt-lint