Files
CV_Site_Nuxt/.pre-commit-config.yaml
T
Noel Sabia eebd6ca697
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / Lint + typecheck (pull_request) Successful in 1m6s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Successful in 9s
PR Check / Dockerfile lint (droast) (pull_request) Successful in 5s
PR Check / AI code review (opencode) (pull_request) Successful in 48s
fix(ci): publish on a dedicated runner label, immutable version tags
The review's blocker was real: runs-on: ubuntu-latest is the label
pr-checker.yml uses, and the job needs a runner-wide Docker socket, so the
only working configuration violated the trust boundary in the decision
doc. The job now runs on a dedicated 'publish' label that only a second
act_runner registration (docker_host: automount) may carry.

Version tags are now immutable: before building, the registry v2 API is
asked for manifests/<version> and 200 aborts the run. docker manifest
inspect cannot do this job - the pinned Debian 20.10 client fails on OCI
indexes for existing and missing tags alike (measured).

Also: the smoke test requires a rendered body (10 kB floor) on top of the
2xx, .github/actionlint.yaml declares the custom label, and the actionlint
hook passes that config explicitly because this repo keeps workflows in
.gitea/workflows, where actionlint does not auto-discover it.
2026-10-24 19:24:47 +02:00

91 lines
3.7 KiB
YAML

# Pre-commit guardrails — deterministic checks that run before every commit.
# Cheap things live here (seconds); slow things (typecheck, build, tests,
# Snyk, AI review) stay in CI (.gitea/workflows/pr-checker.yml).
#
# One-time setup per machine:
# pre-commit install # pre-commit stage
# pre-commit install --hook-type commit-msg # commit-msg stage (release-please!)
# pre-commit run --all-files # first full pass
#
# ARM64 + x86_64 both supported by every hook below.
repos:
# ---------------------------------------------------------------- gitleaks
# Block secrets before they enter history. CI scans history too (gitleaks
# job), but this prevents the commit from ever existing.
- repo: https://github.com/gitleaks/gitleaks
rev: v8.30.1
hooks:
- id: gitleaks
# -------------------------------------------------- basic file hygiene ---
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: mixed-line-ending
args: [--fix=lf]
- id: check-yaml
- id: check-json
- id: check-toml
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=1024]
# Self-hosted variable fonts are multi-MB by design (page-weight is
# a serving-layer concern, not a repo concern).
exclude: \.woff2$
- id: detect-private-key
# ------------------------------------------------ conventional commits ---
# release-please silently ignores non-conventional messages, so a bad
# subject line means "no release and no idea why". This makes it
# impossible. Runs on the commit-msg stage, not pre-commit.
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.19.2
hooks:
- id: commitizen
stages: [commit-msg]
# ---------------------------------------------------- workflow linting ---
# Validates .gitea/workflows syntax and ${{ }} expressions - the class of
# bug that hashFiles-skipping and broken YAML came from.
- repo: https://github.com/rhysd/actionlint
rev: v1.7.12
hooks:
- id: actionlint
files: \.gitea/workflows/.*\.ya?ml$
# actionlint only auto-loads its config when the file is
# .github/actionlint.yaml *and* it recognises a project root by
# .github/workflows, which this repo does not have (it uses
# .gitea/workflows). Pass the config explicitly, or the custom
# `publish` runner label is reported as unknown.
args: [-config-file, .github/actionlint.yaml]
# --------------------------------------------------------- ESLint (Nuxt) -
# Local hook: needs `pnpm install` to have run in this repo. --fix makes
# it a helper; only staged files are linted (fast). When --fix rewrites
# a staged file, pre-commit aborts the commit ("files were modified") -
# re-stage and commit again; that re-stage loop is the standard price
# of a fixer hook.
- repo: local
hooks:
- id: eslint
name: eslint --fix (staged files)
# no shell wrapper: pre-commit appends the staged filenames to the
# entry itself. A 'bash -c' wrapper would eat the first filename
# as $0 and eslint would get no file arguments at all (linting the
# whole repo instead - review finding on this PR, empirically
# verified).
entry: pnpm exec eslint --fix
language: system
files: \.(vue|ts|js|mjs|cjs)$
# When Go services arrive, add:
# - repo: https://github.com/dnephin/pre-commit-golang
# rev: <latest>
# hooks:
# - id: go-fmt
# - id: go-imports
# - id: golangci-lint # or go-vet for a lighter pass