From 68020ee51695a15b3e93f117aa90728f7ab87ecd Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Wed, 13 Nov 2024 14:37:43 +0100 Subject: meta: Add pre-commit checks --- .github/workflows/meta-checks.yml | 51 +++++++++++++++++++++++++++++++++++++++ .github/workflows/reuse.yml | 18 -------------- 2 files changed, 51 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/meta-checks.yml delete mode 100644 .github/workflows/reuse.yml (limited to '.github') diff --git a/.github/workflows/meta-checks.yml b/.github/workflows/meta-checks.yml new file mode 100644 index 0000000..8a15be2 --- /dev/null +++ b/.github/workflows/meta-checks.yml @@ -0,0 +1,51 @@ +# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. +# SPDX-FileCopyrightText: 2023 Linnea Gräf +# +# SPDX-License-Identifier: CC0-1.0 + +name: Pre commit checks + +on: [ push, pull_request ] + +jobs: + reuse: + name: Run REUSE Compliance check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + name: Checkout Repository + - name: REUSE Compliance Check + uses: fsfe/reuse-action@140e81ab76b30d9c5641b7b11e28222b3a11f8f9 + + pre-commit-generate: + name: Generate PRE-Commit hooks + runs-on: ubuntu-latest + outputs: + hooks: ${{ steps.generate-matrix.outputs.hooks }} + steps: + - uses: actions/checkout@v4 + name: Checkout Repository+ + - name: Generate matrix + id: generate-matrix + run: | + printf 'hooks=' >>"$GITHUB_OUTPUT" + # Note: GitHub runner image mentions a yq already being installed. That is not jq but for yaml, but another unrelated program + pipx run yq -c '[.repos[]|.hooks[]|.id]' <.pre-commit-config.yaml | tee -a "$GITHUB_OUTPUT" + echo >>"$GITHUB_OUTPUT" + cat "$GITHUB_OUTPUT" + pre-commit: + runs-on: ubuntu-latest + needs: pre-commit-generate + strategy: + matrix: + hook: ${{ fromJSON(needs.pre-commit-generate.outputs.hooks) }} + name: 'PRE-Commit: ${{ matrix.hook }}' + steps: + - uses: actions/checkout@v4 + name: Checkout Repository + - uses: actions/setup-python@v4 + name: Setup Python + - name: Check ${{ matrix.hook }} + uses: pre-commit/action@v3.0.1 + with: + extra_args: ${{ matrix.hook }} --all-files diff --git a/.github/workflows/reuse.yml b/.github/workflows/reuse.yml deleted file mode 100644 index 5d8a289..0000000 --- a/.github/workflows/reuse.yml +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. -# SPDX-FileCopyrightText: 2023 Linnea Gräf -# -# SPDX-License-Identifier: CC0-1.0 - -name: REUSE Compliance Check - -on: [push, pull_request] - -jobs: - test: - name: Run Compliance check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - name: Checkout Repository - - name: REUSE Compliance Check - uses: fsfe/reuse-action@v4 -- cgit