Merge pull request #5 from renovate-bot/renovate/pre-commit-pre-commi… #19
This file contains 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
--- | |
name: "Pre-commit" | |
on: # yamllint disable-line rule:truthy | |
push: | |
branches: | |
- main | |
tags: ["*"] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
# https://github.com/actions/checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Set up Python | |
id: setup-py | |
# https://github.com/actions/setup-python | |
# yamllint disable-line rule:line-length | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
with: | |
python-version: "3.12" | |
- name: Enable cache for pre-commit hooks | |
# https://github.com/actions/cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ~/.cache/pre-commit | |
# yamllint disable-line rule:line-length | |
key: pre-commit|${{ steps.setup-py.outputs.python-version}}|${{ hashFiles('.pre-commit-config.yaml') }} | |
restore-keys: | | |
pre-commit|${{ steps.setup-py.outputs.python-version}}| | |
pre-commit| | |
- name: Run pre-commit checks | |
run: pipx run pre-commit run -a | |
- name: Run pre-commit gc | |
run: pipx run pre-commit gc |