mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-06 12:03:39 +09:00
## What this PR does - Adds a pre-commit hook and a dedicated GitHub Actions workflow that run `make generate` at the repo root to catch drift in generated API code (CRDs, DeepCopy, clients, RBAC) before it lands on main. - Pre-commit hook is scoped to paths that actually affect codegen (`api/`, `pkg/apis/`, `hack/update-codegen.sh`, `hack/boilerplate.go.txt`) so unrelated commits are not slowed down. - CI workflow (`.github/workflows/codegen-drift.yml`) installs Go from `go.mod`, runs `make generate`, and fails on drift with an error pointing contributors to the local fix. - Includes one drift fix the check surfaced: `RestoreJobSpec.Options` (added in #2437) had no `DeepCopyInto` handling — regenerated. ### Release note ```release-note ci(api): add pre-commit hook and GitHub Actions workflow that verify generated API code (CRDs, deepcopy, clients, RBAC) is in sync with `make generate`. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added a CI workflow that checks generated code during PRs and fails the build if generated artifacts diverge. * Added a pre-commit hook that runs generation checks locally to prevent committing outdated generated files. * Fixed deep-copy behavior for backup restore job specs so nested options are correctly duplicated. <!-- end of auto-generated comment: release notes by coderabbit.ai -->