mirror of
https://github.com/kuhyx/utils.git
synced 2026-11-28 08:29:19 +01:00
Bug-class-check: none — gate policy change (kuhy 2026-11-27) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWZDq7ef5JyQd7Rx3Ju
55 lines
2.5 KiB
YAML
55 lines
2.5 KiB
YAML
name: game_recording pre-commit
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
# The workflow's own file counts as game_recording: editing only this file used
|
|
# to trigger nothing, so a fix to the job itself could never prove itself.
|
|
paths: ['game_recording/**', '.github/workflows/game-recording-precommit.yml']
|
|
pull_request:
|
|
branches: [main]
|
|
paths: ['game_recording/**', '.github/workflows/game-recording-precommit.yml']
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.x"
|
|
# Only pre-commit itself. Every hook runs in its own isolated
|
|
# env -- ruff-format comes from its own repo+rev, and the local hooks
|
|
# need nothing beyond bash and python3 -- so installing the full requirements.txt spent 9s a run on
|
|
# packages no pre-commit-stage hook imports. Verified by running this
|
|
# package's config green in a venv holding pre-commit and nothing else.
|
|
# The pin is read out of requirements.txt rather than repeated here, so
|
|
# it cannot drift from what the dependency-freshness gate governs.
|
|
- name: Install pre-commit
|
|
run: |
|
|
pip install "$(grep '^pre-commit==' game_recording/requirements.txt)"
|
|
|
|
# Keyed on THIS package's config. pre-commit/action@v3.0.1 caches on
|
|
# hashFiles('.pre-commit-config.yaml') -- the repo ROOT's -- so editing
|
|
# this package's config would not invalidate it, and other jobs in the
|
|
# repo that cache hooks under that key could overwrite it with a
|
|
# different hook set. A key from this config cannot go stale that way.
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache/pre-commit
|
|
key: >-
|
|
pre-commit-game-recording-${{ env.pythonLocation }}-${{
|
|
hashFiles('game_recording/.pre-commit-config.yaml') }}
|
|
# Prefix fallback, or this fix would evaporate on the very
|
|
# event that motivated it: bumping a hook rev changes the
|
|
# exact key, and a total miss means reinstalling every hook
|
|
# again. pre-commit's store is keyed internally by hook
|
|
# repo+rev, so a superseded entry is ignored disk rather
|
|
# than a wrong hook, and cache still re-saves under the new
|
|
# exact key after a prefix-only hit.
|
|
restore-keys: pre-commit-game-recording-${{ env.pythonLocation }}-
|
|
- name: Run the hooks
|
|
run: >-
|
|
pre-commit run --config game_recording/.pre-commit-config.yaml
|
|
--all-files --show-diff-on-failure
|