Skip to content

Require repository name for visibility changes#13505

Open
stevenjoezhang wants to merge 1 commit into
cli:trunkfrom
stevenjoezhang:codex/repo-visibility-confirmation
Open

Require repository name for visibility changes#13505
stevenjoezhang wants to merge 1 commit into
cli:trunkfrom
stevenjoezhang:codex/repo-visibility-confirmation

Conversation

@stevenjoezhang

Copy link
Copy Markdown

Fixes #13435

Summary

This updates the interactive gh repo edit visibility flow to require typing the full OWNER/REPO repository name before applying a visibility change, instead of accepting a yes/no confirmation.

The non-interactive --accept-visibility-change-consequences behavior is unchanged.

Motivation

Changing a public repository to private can have lasting consequences for stars, watchers, forks, and repository network state. A recent Hexo incident showed how easy it is to run gh repo edit from the wrong local checkout and only notice the repository name after the change has already happened: hexojs/site#2534

Requiring the full repository name makes the interactive CLI flow closer to the safer confirmation pattern used by repository deletion and GitHub.com.

Testing

  • go test ./pkg/cmd/repo/edit

@github-actions github-actions Bot added external pull request originating outside of the CLI core team needs-triage needs to be reviewed labels May 24, 2026
@stevenjoezhang stevenjoezhang marked this pull request as ready for review May 24, 2026 08:18
@stevenjoezhang stevenjoezhang requested a review from a team as a code owner May 24, 2026 08:18
@stevenjoezhang stevenjoezhang requested review from babakks and Copilot May 24, 2026 08:18
@github-actions github-actions Bot added ready-for-review and removed needs-triage needs to be reviewed labels May 24, 2026
@github-actions

Copy link
Copy Markdown

Thanks for your pull request! While it doesn't meet all of our standard requirements, it appears to be a small, focused contribution and has been routed to the team for review.

Note: We still encourage linking to an issue with the help wanted label when possible, as it helps us prioritize and track contributions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR changes the interactive repo edit flow to require typing the full OWNER/REPO name to confirm visibility changes, instead of a simple yes/no confirmation prompt.

Changes:

  • Replaced visibility-change confirmation from Confirm() to Input() with repo full-name matching.
  • Updated interactive tests to reflect the new typed-confirmation behavior.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/cmd/repo/edit/edit.go Implements typed OWNER/REPO confirmation before applying a visibility change.
pkg/cmd/repo/edit/edit_test.go Updates interactive tests to validate matching vs non-matching typed confirmation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cmd/repo/edit/edit.go
return err
}
if confirmed {
if confirmedRepository == repoFullName {
Comment thread pkg/cmd/repo/edit/edit.go
}
if confirmed {
if confirmedRepository == repoFullName {
opts.Edits.Visibility = &selectedVisibility
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external pull request originating outside of the CLI core team ready-for-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

It is too easy to accidentally private the wrong repository in gh repo edit

2 participants