Skip to content

Report whether an issue fork exists and stop setup-remote when it does not - #384

Merged
mglaman merged 1 commit into
mainfrom
fix/fork-exists
Sep 16, 2026
Merged

mglaman merged 1 commit into
mainfrom
fix/fork-exists

Conversation

@mglaman

@mglaman mglaman commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Fixes #379.

issue:get-fork printed fork URLs for a fork that did not exist, and --format=json and --format=llm gave no way to tell that from a fork with no branches. issue:setup-remote then added the remote, failed on the fetch, and left the dead remote behind.

What changed

  • IssueForkResult gains exists, set from the outcome of the project lookup the action already made. No extra request. The branch lookup runs separately, so a failed branch listing cannot report a missing fork.
  • All formats print it: "exists": false in json, <exists>false</exists> in llm, **Exists:** no in md. The text format now distinguishes "Fork does not exist yet" from "Fork exists but has no branches yet".
  • issue:setup-remote throws before adding the remote when the fork does not exist. issue:checkout stops with the same message instead of offering to run setup-remote.
  • The bundled drupalorg-cli and drupalorg-work-on-issue skills document the flag and the new error.

Testing

Unit tests cover a fork with branches, a fork with no branches, a 503 on the branch listing, a missing fork, and that setup-remote never reaches git when the fork is missing.

Live, without a token, against poll issue 3007808 which has no fork:

drupalorg issue:get-fork 3007808 --format=llm --no-cache   # <exists>false</exists>
drupalorg issue:setup-remote poll#3007808                   # stops, no remote added
drupalorg issue:checkout poll#3007808 -n                    # stops, exit 1

🤖 Generated with Claude Code

…t does not

issue:get-fork printed fork URLs for forks that do not exist, and the
json and llm formats gave no way to tell that from a fork with no
branches. issue:setup-remote then added the remote, failed on the
fetch, and left the dead remote behind.

The project lookup already answers the question, so the action now
records its outcome as an exists flag on the result. The branch lookup
is separate so a failed listing cannot report a missing fork.
setup-remote and checkout stop before touching git when the flag is
false.

Fixes #379

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@mglaman
mglaman merged commit e4cabb3 into main Sep 16, 2026
9 checks passed
@mglaman
mglaman deleted the fix/fork-exists branch September 16, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

issue:get-fork: report whether the fork exists, and stop setup-remote when it does not

1 participant