Skip to content

Commit 2f73d5f

Browse files
iwstkhrclaude
andcommitted
chore(pre-commit): pin hook revs to commit SHAs
Pin each rev to the commit SHA of its current tag with a "# frozen: <tag>" comment so Renovate updates both the SHA and the tag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent e7b764a commit 2f73d5f

2 files changed

Lines changed: 12 additions & 11 deletions

File tree

‎.pre-commit-config.yaml‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Shared pre-commit config template for all repositories.
22
# Copy it into each repository; Renovate keeps the rev values up to date.
3+
# Pin each rev to a commit SHA with a "# frozen: <tag>" comment so Renovate updates both.
34
# Hooks with no matching files are skipped, so unused hooks can stay in place.
45
# See README.md for per-repository adjustments, such as excluding generated files.
56
# Install both hook types so the commit-msg hook runs: pre-commit install
@@ -14,7 +15,7 @@ repos:
1415
##########################################################
1516
# General file fixers and syntax checks
1617
- repo: https://github.com/pre-commit/pre-commit-hooks
17-
rev: v6.0.0
18+
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
1819
hooks:
1920
# Change to [--unsafe] for YAML with custom tags, such as CloudFormation
2021
- id: check-yaml
@@ -26,25 +27,25 @@ repos:
2627

2728
# Lint GitHub Actions workflows
2829
- repo: https://github.com/rhysd/actionlint
29-
rev: v1.7.12
30+
rev: 914e7df21a07ef503a81201c76d2b11c789d3fca # frozen: v1.7.12
3031
hooks:
3132
- id: actionlint
3233

3334
# Check commit messages against Conventional Commits (commit-msg stage)
3435
- repo: https://github.com/compilerla/conventional-pre-commit
35-
rev: v4.4.0
36+
rev: 91ab4bf57e58b32adf1a122681f6ebe164d081c8 # frozen: v4.4.0
3637
hooks:
3738
- id: conventional-pre-commit
3839

3940
# Detect secrets such as API keys and tokens
4041
- repo: https://github.com/gitleaks/gitleaks
41-
rev: v8.30.1
42+
rev: 83d9cd684c87d95d656c1458ef04895a7f1cbd8e # frozen: v8.30.1
4243
hooks:
4344
- id: gitleaks
4445

4546
# Static analysis for security issues and bugs
4647
- repo: https://github.com/semgrep/pre-commit
47-
rev: v1.180.0
48+
rev: 225f70772e8c65f2bdd38ef3164807e907d09e49 # frozen: v1.180.0
4849
hooks:
4950
- id: semgrep
5051
# args replace the hook defaults, so keep --skip-unknown-extensions and the others here
@@ -53,7 +54,7 @@ repos:
5354

5455
# Scan dependencies for vulnerabilities and IaC for misconfigurations (requires Docker)
5556
- repo: https://github.com/mxab/pre-commit-trivy
56-
rev: v0.73.0
57+
rev: db55d941954f2342c6355b6b9fba61f9ce6583e0 # frozen: v0.73.0
5758
hooks:
5859
- id: trivyfs-docker
5960
# Secret scanning is left to gitleaks; the last arg is the path to scan
@@ -63,13 +64,13 @@ repos:
6364

6465
# Lint Markdown
6566
- repo: https://github.com/DavidAnson/markdownlint-cli2
66-
rev: v0.23.3
67+
rev: 916ad0aaa108c64d294101002066f530ea170b10 # frozen: v0.23.3
6768
hooks:
6869
- id: markdownlint-cli2
6970

7071
# Lint shell scripts
7172
- repo: https://github.com/koalaman/shellcheck-precommit
72-
rev: v0.11.0
73+
rev: 99470f5e12208ff0fb17ab81c3c494f7620a1d8d # frozen: v0.11.0
7374
hooks:
7475
- id: shellcheck
7576

@@ -78,13 +79,13 @@ repos:
7879
##########################################################
7980
# Lint JavaScript and TypeScript files with Biome
8081
- repo: https://github.com/biomejs/pre-commit
81-
rev: v2.5.13 # Use the sha / tag you want to point at
82+
rev: 742ab683a70977bd4648797d799ddd6b5496ae87 # frozen: v2.5.13
8283
hooks:
8384
- id: biome-check
8485

8586
# Lint and format Python files with Ruff
8687
- repo: https://github.com/astral-sh/ruff-pre-commit
87-
rev: v0.16.8
88+
rev: 2eeb5678de71a00c0902cbda7105d328432f72cb # frozen: v0.16.8
8889
hooks:
8990
- id: ruff-check
9091
# --extend-select S adds the flake8-bandit security rules on top of the repository's Ruff config

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pre-commit install
2020

2121
`default_install_hook_types` in the config makes `pre-commit install` set up both the `pre-commit` and the `commit-msg` hook, so no extra flags are needed. Repositories that ran `pre-commit install` before the `commit-msg` hook was added need to run it once more.
2222

23-
After copying, Renovate (`:enablePreCommit`) keeps each repository's `rev` values up to date.
23+
After copying, Renovate (`:enablePreCommit`) keeps each repository's `rev` values up to date. Each `rev` is pinned to a commit SHA with a `# frozen: <tag>` comment, and Renovate updates both the SHA and the tag. A bare SHA without the comment is treated as a version and is not updated correctly, so keep the comment when adding a hook. `pre-commit autoupdate --freeze` writes the same format.
2424

2525
### Included hooks
2626

0 commit comments

Comments
 (0)