All checks were successful
Deploy Fly.io Proxy / deploy (push) Successful in 1m45s
## Summary Monthly tooling dependency refresh, with a one-time conversion from version-tag pins (`rev = "vX.Y.Z"`, `image:tag`, `>=`) to SHA / digest pins everywhere. ## Changes - **prek hooks**: all `rev = "vX.Y.Z"` → commit SHA + `# vX.Y.Z` comment. Bumped trufflehog (3.94.0→3.95.2), kingfisher (1.91.0→1.97.0), ruff (0.15.7→0.15.12), shfmt (3.13.0→3.13.1), prettier (3.8.1→3.8.3), actionlint (1.7.11→1.7.12). - **fly/Dockerfile**: tag pins → `image@sha256:...` digest pins. Bumped nginx (1.29.6→1.30.0-alpine), tailscale (v1.94.1→v1.94.2 — still inside the safe pre-1.96.5 range), alloy (v1.14.1→v1.16.0). - **mise-tasks**: PEP 723 inline deps converted from `>=` to `==` (PEP 508 doesn't support hashes inline). All scripts pinned to current latest: rich 15.0.0, typer 0.25.0, pyyaml 6.0.3, httpx 0.28.1. - **prek `additional_dependencies`**: ansible-lint==26.4.0, ansible-core==2.20.5. - **taplo-lint**: pass `--no-schema`. Upstream's `--default-schema-catalogs` returns a format taplo v0.9.3 can't parse — we don't validate against TOML schemas anyway, so this turns off the broken catalog fetch. - **docs/update-tooling-dependencies**: documents the SHA-pin convention, `docker buildx imagetools inspect` for digest lookup, and `prek clean` before re-verifying (cache grows to several GiB). Forgejo workflow `actions/checkout@v6.0.2` was already at the latest SHA — no change. ## Test plan - [x] `prek run --all-files` passes after `prek clean` - [x] `deploy-fly` workflow builds and deploys the new fly image on merge - [x] `fly status -a blumeops-proxy` healthy after deploy - [x] Spot-check a few mise tasks (`mise run blumeops-tasks`, `mise run docs-check-links`) to confirm pinned deps resolve cleanly Reviewed-on: #344
115 lines
3.6 KiB
Text
Executable file
115 lines
3.6 KiB
Text
Executable file
#!/usr/bin/env -S uv run --script
|
|
# /// script
|
|
# requires-python = ">=3.12"
|
|
# dependencies = ["rich==15.0.0"]
|
|
# ///
|
|
#MISE description="Check that all docs have required frontmatter fields"
|
|
"""Validate that all documentation files have required YAML frontmatter.
|
|
|
|
Required fields: title, tags, modified
|
|
|
|
Scans all markdown files in docs/ (excluding changelog.d/) and checks
|
|
that each file has YAML frontmatter containing the required fields.
|
|
|
|
Usage: mise run docs-check-frontmatter
|
|
"""
|
|
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
from rich.console import Console
|
|
from rich.table import Table
|
|
|
|
DOCS_DIR = Path(__file__).parent.parent / "docs"
|
|
HOWTO_DIR = DOCS_DIR / "how-to"
|
|
REQUIRED_FIELDS = {"title", "tags", "modified"}
|
|
# These fields are only permitted in docs/how-to/
|
|
HOWTO_ONLY_FIELDS = {"status", "requires"}
|
|
|
|
# Match YAML frontmatter block
|
|
FRONTMATTER_PATTERN = re.compile(r"^---\n(.*?)\n---\n", re.DOTALL)
|
|
|
|
# Match top-level YAML keys (not indented)
|
|
KEY_PATTERN = re.compile(r"^([a-zA-Z][a-zA-Z0-9_-]*):", re.MULTILINE)
|
|
|
|
|
|
def extract_frontmatter_keys(file_path: Path) -> set[str] | None:
|
|
"""Extract top-level keys from YAML frontmatter. Returns None if no frontmatter."""
|
|
content = file_path.read_text()
|
|
match = FRONTMATTER_PATTERN.match(content)
|
|
if not match:
|
|
return None
|
|
frontmatter = match.group(1)
|
|
return set(KEY_PATTERN.findall(frontmatter))
|
|
|
|
|
|
def main() -> int:
|
|
console = Console()
|
|
console.print("[bold]Frontmatter Validation[/bold]")
|
|
console.print(f"Required fields: {', '.join(sorted(REQUIRED_FIELDS))}")
|
|
console.print()
|
|
|
|
missing_issues: list[tuple[str, set[str]]] = []
|
|
misplaced_issues: list[tuple[str, set[str]]] = []
|
|
|
|
for md_file in sorted(DOCS_DIR.rglob("*.md")):
|
|
if "changelog.d" in md_file.parts:
|
|
continue
|
|
|
|
rel_path = str(md_file.relative_to(DOCS_DIR))
|
|
keys = extract_frontmatter_keys(md_file)
|
|
|
|
if keys is None:
|
|
missing_issues.append((rel_path, REQUIRED_FIELDS))
|
|
continue
|
|
|
|
missing = REQUIRED_FIELDS - keys
|
|
if missing:
|
|
missing_issues.append((rel_path, missing))
|
|
|
|
# Check that status/requires only appear in how-to docs
|
|
is_howto = HOWTO_DIR in md_file.parents or md_file.parent == HOWTO_DIR
|
|
if not is_howto:
|
|
misplaced = keys & HOWTO_ONLY_FIELDS
|
|
if misplaced:
|
|
misplaced_issues.append((rel_path, misplaced))
|
|
|
|
has_issues = bool(missing_issues or misplaced_issues)
|
|
|
|
if missing_issues:
|
|
console.print("[bold red]Missing Required Frontmatter[/bold red]")
|
|
console.print()
|
|
table = Table(show_header=True, header_style="bold")
|
|
table.add_column("File")
|
|
table.add_column("Missing Fields")
|
|
|
|
for rel_path, missing in missing_issues:
|
|
table.add_row(rel_path, ", ".join(sorted(missing)))
|
|
|
|
console.print(table)
|
|
console.print()
|
|
|
|
if misplaced_issues:
|
|
console.print("[bold red]Misplaced Frontmatter Fields[/bold red]")
|
|
console.print(f"[dim]These fields are only allowed in {HOWTO_DIR.relative_to(DOCS_DIR)}/[/dim]")
|
|
console.print()
|
|
table = Table(show_header=True, header_style="bold")
|
|
table.add_column("File")
|
|
table.add_column("Disallowed Fields")
|
|
|
|
for rel_path, misplaced in misplaced_issues:
|
|
table.add_row(rel_path, ", ".join(sorted(misplaced)))
|
|
|
|
console.print(table)
|
|
console.print()
|
|
|
|
if has_issues:
|
|
return 1
|
|
|
|
console.print("[bold green]All docs have required frontmatter![/bold green]")
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|