release.sh: refuse to pin from a non-master branch (the pin commit lands on master)

This commit is contained in:
inference-admin committed 2026-10-26 01:39:15 +00:00
1 parent bb2503bb47
commit 2357d5d55a
1 file changed
+5 -1
+5 -1
View File
@@ -49,6 +49,10 @@ cmd_build() {
cmd_pin() { cmd_pin() {
local tag="${1:-}" ; [ -n "$tag" ] || die "usage: release.sh pin <tag>" local tag="${1:-}" ; [ -n "$tag" ] || die "usage: release.sh pin <tag>"
local br; br=$(git rev-parse --abbrev-ref HEAD)
if [ "$br" != "master" ] && [ "${ALLOW_BRANCH:-0}" != "1" ]; then
die "on branch '$br' — the pin commit goes to master, so merge your change first (or set ALLOW_BRANCH=1 if you really mean it)"
fi
python3 - "$tag" <<'PY' python3 - "$tag" <<'PY'
import json, sys import json, sys
tag = sys.argv[1] tag = sys.argv[1]
@@ -61,7 +65,7 @@ print(f'dockerImage: {old} -> {m["dockerImage"]}')
PY PY
git add "$MANIFEST" git add "$MANIFEST"
git commit -q -m "Pin manifest to $tag" git commit -q -m "Pin manifest to $tag"
git push -q origin HEAD:master git push -q
ok "pinned + pushed $tag" ok "pinned + pushed $tag"
} }