Skip to content

fix: two-step EMU repo visibility change for create and settings update - #445

Merged
saracarl merged 1 commit into
copilot/add-utexas-login-buttonfrom
copilot/implement-two-step-repository-visibility-change
Jul 17, 2026
Merged

fix: two-step EMU repo visibility change for create and settings update#445
saracarl merged 1 commit into
copilot/add-utexas-login-buttonfrom
copilot/implement-two-step-repository-visibility-change

Conversation

Copilot AI commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

GitHub's template generation API has no visibility: 'internal' parameter — only private: true/false. EMU orgs also reject private: false (public) on PATCH. Both the creation and settings-update paths need explicit handling.

Changes

POST /api/projects/[projectName] (creation)

  • createRepositoryFromTemplate already sets private: true when repoVisibility === 'internal' (template API limitation)
  • Added clarifying comment explaining the two-step sequence: create private → PATCH to internal

PUT /api/projects/[projectName] (settings update)

  • Bug: toggling is_private from truefalse sent { private: false }, which attempts a public visibility change that fails on EMU orgs
  • Fix: detect enterprise context and use 'internal' as the target visibility instead:
const isEnterprise =
  isEnterpriseGitHubOrg(slugContents.org) ||
  cookies.get('auth-provider')?.value === 'utexas';
const targetVisibility: boolean | 'internal' =
  !body.is_private && isEnterprise ? 'internal' : body.is_private;

Enterprise is detected via GITHUB_ENTERPRISE_ORGS env var or the auth-provider=utexas cookie set during UTexas EMU OAuth.

Copilot AI changed the title fix: two-step repository visibility change for GitHub EMU accounts (create + settings update) fix: two-step EMU repo visibility change for create and settings update Jul 17, 2026
Copilot AI requested a review from saracarl July 17, 2026 19:31
@saracarl
saracarl marked this pull request as ready for review July 17, 2026 19:40
@saracarl
saracarl merged commit a15f296 into copilot/add-utexas-login-button Jul 17, 2026
1 check passed
Copilot stopped work on behalf of saracarl due to an error July 17, 2026 19:48
@saracarl

Copy link
Copy Markdown
Contributor

@copilot When we test this, we get a "The repository was not successfully created." even though the repo was created. It was created was "private" with no change to "internal" I wonder if the code is trying to create the repository twice instead of updating the visibility.

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.

2 participants