engineering-handbook/hooks/pre-push
Adam Moussa 4b5d39fb91
Add CDK version policy, update Node 24 and GitHub Actions CI/CD (#6)
* Update CDK version policy, Node 24 runtime, and GitHub Actions CI/CD

- Pin blessed aws-cdk-lib version (2.253.1) with upgrade procedure
- Update Lambda runtime default from Node 22 to Node 24
- Rewrite CI/CD page to reflect GitHub Actions reusable workflows
  (was still referencing CodePipeline/CodeBuild)

* Add pre-push hook for npm ci validation

Catches lock file drift locally before it breaks CI. Includes
install instructions in git-workflow.md.

* Add repo provisioning script

Automates the new-repo checklist: GitHub repo creation, OIDC deploy
role, repo secret, security features, CI/CD workflow stubs, and
pre-push hook installation. Supports both SAM and CDK stack types.

* Add shared VpnEc2Instance CDK construct

Reference construct for the VPN-accessible EC2 pattern used by
file-share and forgejo. Includes VPC/subnet lookup, SG, IAM role,
encrypted EBS, and DLM snapshots. Copy into lib/constructs/.

* Add post-deploy health check template

Template script for project-specific health checks. Copy to
scripts/health-check.sh — CD workflows run it automatically.
2026-05-14 18:39:13 -04:00

19 lines
573 B
Bash
Executable file

#!/usr/bin/env bash
# Pre-push hook: verify npm ci passes before pushing Node.js projects.
# Catches lock file drift that would break CI.
#
# Install: cp hooks/pre-push .git/hooks/pre-push && chmod +x .git/hooks/pre-push
set -euo pipefail
if [[ ! -f package-lock.json ]]; then
exit 0
fi
echo "pre-push: running npm ci..."
if ! npm ci --ignore-scripts --no-audit --no-fund 2>/dev/null; then
echo "pre-push: npm ci failed — lock file may be out of sync."
echo "Run: rm -rf node_modules package-lock.json && npm install"
exit 1
fi
echo "pre-push: npm ci passed."