From 40b0fa72ad54a09ca12d70c1e5bbc3540768a22b Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Wed, 15 Jan 2025 11:31:04 -0600 Subject: [PATCH] add pre-commit --- .github/workflows/pre-commit.yml | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..ce0100a --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,40 @@ +# SPDX-FileCopyrightText: Copyright (c) 2019 Anthony Sottile +# +# SPDX-License-Identifier: MIT + +name: pre-commit + +on: + push: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + pre-commit: + runs-on: ubuntu-24.04 + steps: + - name: Set up repository + uses: actions/checkout@v4 + with: + submodules: false + show-progress: false + fetch-depth: 1 + persist-credentials: false + - name: Set up python + uses: actions/setup-python@v5 + with: + python-version: 3.x + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 + - name: Make patch + if: failure() + run: git diff > ~/pre-commit.patch + - name: Upload patch + if: failure() + uses: actions/upload-artifact@v4 + with: + name: patch + path: ~/pre-commit.patch