mirror of
https://github.com/RayLabsHQ/gitea-mirror.git
synced 2026-05-22 23:51:42 -05:00
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/273
Author: @arunavo4
Created: 4/20/2026
Status: ✅ Merged
Merged: 4/20/2026
Merged by: @arunavo4
Base:
main← Head:fix/gh-api-url-enterprise-routing📝 Commits (2)
221157afix: honor GH_API_URL across all Octokit call sitesf96d625fix: address review findings📊 Changes
6 files changed (+81 additions, -75 deletions)
View changed files
📝
src/lib/gitea-enhanced.ts(+4 -5)📝
src/lib/scheduler-service.ts(+13 -15)📝
src/pages/api/github/test-connection.test.ts(+46 -44)📝
src/pages/api/github/test-connection.ts(+5 -5)📝
src/pages/api/sync/repository.ts(+10 -1)📝
src/tests/test-metadata-mirroring.ts(+3 -5)📄 Description
Summary
createGitHubClient()and constructednew Octokit(...)directly, soGH_API_URL/GITHUB_API_URLwere silently ignored outside a handful of flows. GHES and GHEC-with-data-residency users hithttps://api.github.com/...and got 401s even when the env var was set correctly (reported in #269, with the Test Connection button as the most visible symptom).createGitHubClient()so Enterprise endpoints work everywhere. Makes the helper'stokenparam optional to preserve the one unauthenticated caller (public-repo sync).Call sites fixed
src/pages/api/github/test-connection.tssrc/pages/api/sync/repository.tssrc/lib/gitea-enhanced.tssrc/lib/scheduler-service.tssrc/tests/test-metadata-mirroring.tsSide benefit: scheduler + sync paths now also get throttling, rate-limit tracking, and the standard
gitea-mirror/<version>User-Agent — which were previously missing.Test plan
bun test— 231 pass, 0 fail (was 229 pass / 2 fail before the test-connection test update; see note below)bun run build— cleanGH_API_URL→ confirm standard github.com flows still work (regression)GH_API_URL=https://api.TENANT.ghe.com, hit Test Connection in the GitHub settings panel, confirm request goes to the configured host and authenticatesNote on the test-connection test file
The existing test mocked
@octokit/restdirectly, butgithub.tscaptures theOctokitreference at module init when wrapping it with the throttling plugin, so by the time the mock registers the real reference is already baked into the closure. Retargeted the mock to@/lib/github(mocking at the helper layer) so it intercepts correctly. Same test surface, same assertions.Fixes #269
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.