From 586ebb30c42069e7eda61b8a2314cc359437f33c Mon Sep 17 00:00:00 2001 From: Serina Mcfall Date: Fri, 14 Aug 2026 20:19:59 +1200 Subject: [PATCH] docs(launchpad): document gh repo set-default for this fork MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a fresh clone with no default set, gh resolves issue/PR operations to block/buzz (the parent repository) rather than this fork for any command with no explicit --repo — measured: gh issue view 116 failed to resolve an issue that exists here, and gh pr ready 124 reported block/buzz#124, a different closed PR (#136). The dangerous case is a write that succeeds silently: gh issue create and gh pr comment resolve through the same base-repository path, so an agent that builds a command programmatically and omits --repo posts into upstream's public tracker with no warning at all. Documented the one-time fix (gh repo set-default launchpad-26/buzz) in both places the issue named: launchpad/README.md's "Opening a PR" section, and launchpad/AGENTS.md §6 alongside the gh pr create examples that assume it. launchpad/scripts/test-gh-set-default-guidance.sh confirms both files mention the command; confirmed it fails against the pre-fix files. Verified: $ bash launchpad/scripts/test-gh-set-default-guidance.sh 2 passed, 0 failed Closes #136 Signed-off-by: Serina Mcfall --- launchpad/AGENTS.md | 7 ++++ launchpad/README.md | 7 ++++ .../scripts/test-gh-set-default-guidance.sh | 33 +++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100755 launchpad/scripts/test-gh-set-default-guidance.sh 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 ]