diff --git a/launchpad/AGENTS.md b/launchpad/AGENTS.md index ea52844d271..8c757f15f00 100644 --- a/launchpad/AGENTS.md +++ b/launchpad/AGENTS.md @@ -226,6 +226,13 @@ gh pr create --base launchpad place it is stated without admin. - **Do not force-push during review.** Push new commits instead — force-pushing hides what changed from the reviewer. +- **Run `gh repo set-default launchpad-26/buzz` once per clone, before the first + `gh issue create` or `gh pr create`.** Without it, `gh`'s default-repo resolution + targets `block/buzz` — the parent repository — for any command with no explicit + `--repo`. A write aimed at this fork (an issue, a PR comment) silently lands on + upstream's public tracker instead, and the mistake is not visible until someone + looks there. The setting lands in the shared `.git/config`, so it covers every + worktree of the clone, not just the one it was run in. Before running any git command, activate the toolchain or hooks fail on `PATH`: diff --git a/launchpad/README.md b/launchpad/README.md index 8b80be52119..da44a8e3f6a 100644 --- a/launchpad/README.md +++ b/launchpad/README.md @@ -115,6 +115,13 @@ or the CLI. Branch from `launchpad`, commit with `-s` (the DCO check is not optional), and expect to need one approving review — the branch is protected and you can't approve your own. +**Run `gh repo set-default launchpad-26/buzz` once per clone.** This fork's default +branch resolution otherwise targets `block/buzz` — the parent repository — for any `gh` +command with no explicit `--repo`, including `gh issue create` and `gh pr comment`. A +command aimed at this fork silently lands on upstream's public tracker instead. The +setting lands in the shared `.git/config`, so one invocation covers every worktree of +the clone too. + --- ## What's in this directory diff --git a/launchpad/scripts/test-gh-set-default-guidance.sh b/launchpad/scripts/test-gh-set-default-guidance.sh new file mode 100755 index 00000000000..04c164ccdf0 --- /dev/null +++ b/launchpad/scripts/test-gh-set-default-guidance.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env bash +# Verifies #136's fix: both launchpad/README.md and launchpad/AGENTS.md tell +# contributors to run `gh repo set-default launchpad-26/buzz` once per clone, +# so a gh command with no explicit --repo does not silently target block/buzz. +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +LAUNCHPAD_DIR="${SCRIPT_DIR}/.." + +PASS=0 +FAIL=0 + +check() { + local label=$1 ok=$2 + if [ "${ok}" = "0" ]; then + echo "PASS: ${label}" + PASS=$((PASS + 1)) + else + echo "FAIL: ${label}" + FAIL=$((FAIL + 1)) + fi +} + +for f in README.md AGENTS.md; do + status=1 + grep -q "gh repo set-default launchpad-26/buzz" "${LAUNCHPAD_DIR}/${f}" && status=0 + check "${f} tells contributors to run gh repo set-default" "${status}" +done + +echo "" +echo "===================================================" +echo "${PASS} passed, ${FAIL} failed" +[ "${FAIL}" -eq 0 ]