`gh repo create` asks if I want to create an `Internal` repository for an owner that doesn't support such things

#9464

Issue Details

12 months ago
jtmcg
jtmcg
bugp1coregh-repo
jsorefjsoref
opened 12 months ago
Author

Describe the bug

gh --version gh version 2.54.0 (2024-07-31) https://github.com/cli/cli/releases/tag/v2.54.0

Steps to reproduce the behavior

% gh repo create ? What would you like to do? Create a new repository on GitHub from scratch ? Repository name test-internal ? Repository owner jsoref ? Description test creating an internal repository when gh knows this is not allowed
? Visibility [Use arrows to move, type to filter] Public Private > Internal
? Visibility Internal ? Would you like to add a README file? No ? Would you like to add a .gitignore? No ? Would you like to add a license? No ? This will create "test-internal" as a internal repository on GitHub. Continue? Yes GraphQL: Only organization-owned repositories can have internal visibility (createRepository)

Expected vs actual behavior

Don't show Internal as an option if the owner doesn't support it

Logs

> POST /graphql HTTP/1.1 > Host: api.github.com > Accept: application/vnd.github.merge-info-preview+json, application/vnd.github.nebula-preview > Authorization: token ████████████████████ > Content-Length: 85 > Content-Type: application/json > Graphql-Features: merge_queue > Time-Zone: America/Toronto > User-Agent: GitHub CLI 2.54.0 { "query": "query UserCurrent{viewer{login,organizations(first: 100){nodes{login}}}}" } < HTTP/2.0 200 OK ... { "data": { "viewer": { "login": "jsoref", "organizations": { [ ... ] } } } }