chore(dev): use pre-commit to identify api changes

This commit is contained in:
Matthew Farrellee 2025-08-26 18:09:58 -04:00
parent 9fa69b0337
commit 7083fdd593
2 changed files with 24 additions and 1 deletions

View file

@ -105,6 +105,27 @@ repos:
pass_filenames: false
require_serial: true
files: ^llama_stack/apis/|^docs/openapi_generator/
- id: openapi-spec-check
name: OpenAPI spec change validator
entry: bash
args:
- -c
- |
SPEC_PATH="docs/_static/llama-stack-spec.yaml"
# if the generated spec is part of the staged commit (cached), require [API CHANGE]
if git diff --name-only --cached -- "$SPEC_PATH" | grep -q .; then
if ! grep -q "\[API CHANGE\]" "$(git rev-parse --git-dir)/COMMIT_EDITMSG"; then
echo "ERROR: $SPEC_PATH changed but commit message does not include '[API CHANGE]'."
echo "Please include '[API CHANGE]' in the commit message when modifying the public API spec."
exit 1
fi
fi
- --
language: system
pass_filenames: false
require_serial: true
stages: [commit-msg]
- id: check-workflows-use-hashes
name: Check GitHub Actions use SHA-pinned actions
entry: ./scripts/check-workflows-use-hashes.sh