Last active
December 19, 2025 13:30
-
-
Save schtobia/26e2b886d95a704a7db00e2dccd866de to your computer and use it in GitHub Desktop.
a forgejo action for running pre-commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # SPDX-FileCopyrightText: 2025 Tobias Schmidl | |
| # | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| name: pre-commit | |
| on: | |
| pull_request: | |
| push: | |
| # branches: [main] | |
| env: | |
| extra_args: '--all-files' | |
| jobs: | |
| pre-commit: | |
| runs-on: linux-amd64-docker | |
| container: | |
| image: debian:stable | |
| steps: | |
| - name: prepare minimal env | |
| run: apt-get -qq update && apt-get -qq -y install git nodejs | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| - uses: actions/checkout@v6 | |
| - name: Install requirements | |
| run: apt-get -qq update && xargs apt-get -qq -y install <./dependencies.txt | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| - name: Symlink python3 --> python | |
| run: ln -s /usr/bin/python3 /usr/bin/python | |
| - uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/pre-commit | |
| key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | |
| - name: Run CMake formatter install | |
| run: cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DUSE_CCACHE:BOOL=FALSE -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DUSE_STATIC_ANALYZER=clang-tidy -S . -B build | |
| - name: Run pre-commit | |
| run: pre-commit run --show-diff-on-failure --color=always ${{ env.extra_args }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment