[PR #281] [MERGED] fix: make autoMirrorStarred actually trigger auto-mirror (fixes #278) #2651

Closed
opened 2026-05-15 05:17:32 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/281
Author: @arunavo4
Created: 5/4/2026
Status: Merged
Merged: 5/4/2026
Merged by: @arunavo4

Base: mainHead: fix/auto-mirror-starred-trigger


📝 Commits (1)

  • 8ac0078 fix: make autoMirrorStarred actually trigger auto-mirror (fixes #278)

📊 Changes

2 files changed (+79 additions, -30 deletions)

View changed files

📝 src/lib/scheduler-service.test.ts (+45 -0)
📝 src/lib/scheduler-service.ts (+34 -30)

📄 Description

Summary

Fixes #278. The "Auto-mirror new starred repositories" checkbox under GitHub settings did nothing on its own — it was only a filter layered on top of scheduleConfig.autoMirror, and autoMirror is only settable via the AUTO_MIRROR_REPOS env var (no UI). Users who checked the box saw their starred repos auto-imported but never mirrored, contradicting the label.

This PR makes autoMirror and autoMirrorStarred independent triggers in the scheduler:

  • autoMirror=true → auto-mirror owned (and self-starred) repos
  • autoMirrorStarred=true → auto-mirror repos starred from other owners
  • Either flag entering the auto-mirror phase; the filter scopes the work accordingly

Changes are localized to src/lib/scheduler-service.ts (two spots: runScheduledSync and performInitialAutoStart). No schema change, no migration, no new UI.

Also normalized the owner comparison to lowercase since GitHub usernames are case-insensitive — previously a self-starred repo whose stored owner casing differed from the configured githubConfig.owner would be misclassified as a third-party star and silently skipped.

Behavior change to flag in release notes

Anyone who currently has the starred checkbox on (broken state) will start getting starred repos mirrored on upgrade. Users with AUTO_MIRROR_REPOS=true see no change.

autoMirror autoMirrorStarred Before After
off off nothing nothing
on off owned + self-starred owned + self-starred (unchanged)
off on nothing (bug) third-party starred only
on on everything everything (unchanged)

Test plan

  • bun test src/lib/scheduler-service.test.ts — added a truth-table test pinning all 4 quadrants, plus case-insensitive owner match
  • bun test — full suite, 234 pass / 0 fail
  • bunx tsc --noEmit on src/lib/scheduler-service.ts — no type errors introduced
  • Manual verification (recommended before release): set autoMirrorStarred=true with autoMirror=false on a config with includeStarred=true and confirm new stars get mirrored on the next scheduler tick

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/RayLabsHQ/gitea-mirror/pull/281 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 5/4/2026 **Status:** ✅ Merged **Merged:** 5/4/2026 **Merged by:** [@arunavo4](https://github.com/arunavo4) **Base:** `main` ← **Head:** `fix/auto-mirror-starred-trigger` --- ### 📝 Commits (1) - [`8ac0078`](https://github.com/RayLabsHQ/gitea-mirror/commit/8ac0078efc6f2df4f18ba2f21fd0c210f137484a) fix: make autoMirrorStarred actually trigger auto-mirror (fixes #278) ### 📊 Changes **2 files changed** (+79 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/scheduler-service.test.ts` (+45 -0) 📝 `src/lib/scheduler-service.ts` (+34 -30) </details> ### 📄 Description ## Summary Fixes #278. The "Auto-mirror new starred repositories" checkbox under GitHub settings did nothing on its own — it was only a *filter* layered on top of `scheduleConfig.autoMirror`, and `autoMirror` is only settable via the `AUTO_MIRROR_REPOS` env var (no UI). Users who checked the box saw their starred repos auto-imported but never mirrored, contradicting the label. This PR makes `autoMirror` and `autoMirrorStarred` independent triggers in the scheduler: - `autoMirror=true` → auto-mirror owned (and self-starred) repos - `autoMirrorStarred=true` → auto-mirror repos starred from other owners - Either flag entering the auto-mirror phase; the filter scopes the work accordingly Changes are localized to `src/lib/scheduler-service.ts` (two spots: `runScheduledSync` and `performInitialAutoStart`). No schema change, no migration, no new UI. Also normalized the owner comparison to lowercase since GitHub usernames are case-insensitive — previously a self-starred repo whose stored owner casing differed from the configured `githubConfig.owner` would be misclassified as a third-party star and silently skipped. ## Behavior change to flag in release notes Anyone who currently has the starred checkbox on (broken state) will start getting starred repos mirrored on upgrade. Users with `AUTO_MIRROR_REPOS=true` see no change. | `autoMirror` | `autoMirrorStarred` | Before | After | |---|---|---|---| | off | off | nothing | nothing | | on | off | owned + self-starred | owned + self-starred (unchanged) | | off | on | nothing (bug) | third-party starred only | | on | on | everything | everything (unchanged) | ## Test plan - [x] `bun test src/lib/scheduler-service.test.ts` — added a truth-table test pinning all 4 quadrants, plus case-insensitive owner match - [x] `bun test` — full suite, 234 pass / 0 fail - [x] `bunx tsc --noEmit` on `src/lib/scheduler-service.ts` — no type errors introduced - [ ] Manual verification (recommended before release): set `autoMirrorStarred=true` with `autoMirror=false` on a config with `includeStarred=true` and confirm new stars get mirrored on the next scheduler tick --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-15 05:17:32 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea-mirror#2651