.pre-commit-config.yaml: Autoupdate #210
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: MIL discord-bot CI | |
# yamllint disable-line rule:truthy | |
on: | |
[push, workflow_dispatch] | |
env: | |
# Cache version to control pre-commit caches | |
CACHE_VERSION: 0 | |
# 3.10 is recent enough | |
DEFAULT_PYTHON: 3.10.11 | |
# Location of the pre-commit cache. This is set by pre-commit, not us! | |
PRE_COMMIT_CACHE: ~/.cache/pre-commit | |
# Cancels previous runs targeting the same hash | |
concurrency: | |
group: > | |
${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3.0.2 | |
- name: Setup Python | |
uses: actions/setup-python@v4.1.0 | |
with: | |
python-version: ${{ env.DEFAULT_PYTHON}} | |
cache: "pip" | |
- name: Generate pre-commit cache key | |
id: pre-commit_cache_key | |
run: > | |
echo "::set-output | |
name=key::${{ env.CACHE_VERSION }}-${{ env.DEFAULT_PYTHON }}-${{ | |
hashFiles('.pre-commit-config.yaml') }}" | |
- name: Install pre-commit | |
run: | | |
pip install --upgrade pip | |
pip install "$(cat requirements.txt | grep pre-commit)" | |
- name: Restore base pre-commit environment | |
id: cache-pre-commmit | |
uses: actions/cache@v3.0.4 | |
with: | |
path: ${{ env.PRE_COMMIT_CACHE }} | |
key: > | |
${{ runner.os | |
}}-pre-commit-${{ | |
steps.pre-commit_cache_key.outputs.key }} | |
- name: Install pre-commit dependencies if no cache | |
if: steps.cache-pre-commit.outputs.cache-hit != 'true' | |
run: | | |
pre-commit install-hooks | |
- name: Run hooks | |
run: > | |
SKIP=no-commit-to-branch | |
pre-commit run --all-files --show-diff-on-failure |