mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 21:22:43 +00:00
init: hooks
This commit is contained in:
1 parent
d0ace85bbc
commit
216152d946
1 file changed
+18
Executable
+18
@@ -0,0 +1,18 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Pre-push: the docs pages under apps/docs/content are generated from work/1
|
||||||
|
# by `bun run sync`, and deploy.yml publishes whatever main holds. Regenerate
|
||||||
|
# them now and refuse the push if the result differs from the tree, so a
|
||||||
|
# solution never lands without its page (or with a stale `## Solution`).
|
||||||
|
#
|
||||||
|
# Bypass for a deliberate partial push: git push --no-verify
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
cd "$(git rev-parse --show-toplevel)"
|
||||||
|
report=$(bun run --silent sync)
|
||||||
|
|
||||||
|
changed=$(git status --porcelain -- apps/docs/content)
|
||||||
|
if [ -n "$changed" ]; then
|
||||||
|
printf '%s\n' "$report" | grep -v 'skipped (in sync)' >&2
|
||||||
|
printf '\npre-push: apps/docs/content is out of sync with work/1 — commit the regenerated pages:\n%s\n' "$changed" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user