Skip to content

fix: support renaming repos - #100

Merged
tstollin merged 1 commit into
mainfrom
rename-repos
Aug 12, 2026
Merged

fix: support renaming repos#100
tstollin merged 1 commit into
mainfrom
rename-repos

Conversation

@tstollin

@tstollin tstollin commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes repository renaming support in the Repository reconciler. Previously, changing spec.name on an already-tracked Repository caused the reconciler to look up the repo by its (new) desired name, get a 404 from GitHub, and create a brand-new duplicate repository — silently orphaning the original repo under its old name.

getRepo() now prefers looking up the repository by its stable GitHub ID (Status.ID) via GetRepositoryByID, falling back to name-based lookup only when no ID is stored or the ID lookup finds nothing. Once the current repository is resolved, r.GitHub.Resource.Name is kept in sync with GitHub's actual current name (via the new updateRecFieldsFromGitHub helper, replacing updateID), so that:

  • The rename diff is correctly detected by mapper.RepoDiffers().
  • EditRepository is called with the current (old) name in the URL path and the new name in the request body — matching GitHub's rename semantics (PATCH /repos/{owner}/{current-name} with {"name": "new-name"}).
  • Subsequent reconciliation steps within the same run use the correct, up-to-date name.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Chore (refactoring, CI changes, dependency updates, etc.)

Checklist

  • My commits follow the Conventional Commits format
  • I have added/updated unit tests for any new or changed templates
  • I have updated documentation (README, CONTRIBUTING, values comments) if needed
  • I have updated the generated files using make codegen

Related Issues

@tstollin
tstollin marked this pull request as ready for review August 12, 2026 08:51
@tstollin
tstollin requested a review from a team as a code owner August 12, 2026 08:51
@tstollin
tstollin merged commit d81006f into main Aug 12, 2026
10 checks passed
@tstollin
tstollin deleted the rename-repos branch August 12, 2026 08:51
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.8.5 🎉

The release is available on GitHub release and as container image ghcr.io/interhyp/git-hubby:0.8.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants