[PR #77] [CLOSED] fix: Complete Issue #72 - Fix automatic mirroring and repository cleanup #122

Closed
opened 2026-02-27 15:55:13 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/RayLabsHQ/gitea-mirror/pull/77
Author: @arunavo4
Created: 8/20/2025
Status: Closed

Base: mainHead: issue-72


📝 Commits (5)

  • 698eb0b fix: Complete Issue #72 - Fix automatic mirroring and repository cleanup
  • 38a0d1b repository cleanup functionality
  • fe94d97 Issue 68
  • 926737f Added a few new features.
  • 12ee065 Docs updated | added some options

📊 Changes

21 files changed (+1561 additions, -86 deletions)

View changed files

📝 .env.example (+2 -2)
📝 CHANGELOG.md (+48 -0)
📝 CLAUDE.md (+18 -0)
📝 README.md (+29 -1)
📝 docker-entrypoint.sh (+2 -2)
📝 docs/ENVIRONMENT_VARIABLES.md (+4 -3)
📝 src/components/config/ConfigTabs.tsx (+9 -4)
📝 src/components/config/MirrorOptionsForm.tsx (+26 -0)
📝 src/lib/auth.ts (+27 -8)
📝 src/lib/db/schema.ts (+3 -0)
📝 src/lib/env-config-loader.ts (+7 -3)
📝 src/lib/gitea.ts (+203 -62)
src/lib/repository-cleanup-service.ts (+373 -0)
src/lib/scheduler-service.ts (+286 -0)
📝 src/lib/utils/config-mapper.ts (+2 -1)
src/lib/utils/duration-parser.test.ts (+94 -0)
src/lib/utils/duration-parser.ts (+251 -0)
📝 src/middleware.ts (+42 -0)
src/pages/api/cleanup/trigger.ts (+130 -0)
📝 src/types/Repository.ts (+4 -0)

...and 1 more files

📄 Description

Major fixes for Docker environment variable issues and cleanup functionality:

🔧 Duration Parser & Scheduler Fixes

  • Add comprehensive duration parser supporting "8h", "30m", "24h" formats
  • Fix GITEA_MIRROR_INTERVAL environment variable mapping to scheduler
  • Auto-enable scheduler when GITEA_MIRROR_INTERVAL is set
  • Improve scheduler logging to clarify timing behavior (from last run, not startup)

🧹 Repository Cleanup Service

  • Complete repository cleanup service for orphaned repos (unstarred, deleted)
  • Fix cleanup configuration logic - now works with CLEANUP_DELETE_IF_NOT_IN_GITHUB=true
  • Auto-enable cleanup when deleteIfNotInGitHub is enabled
  • Add manual cleanup trigger API endpoint (/api/cleanup/trigger)
  • Support archive/delete actions with dry-run mode and protected repos

🐛 Environment Variable Integration

  • Fix scheduler not recognizing GITEA_MIRROR_INTERVAL=8h
  • Fix cleanup requiring both CLEANUP_DELETE_FROM_GITEA and CLEANUP_DELETE_IF_NOT_IN_GITHUB
  • Auto-enable services when relevant environment variables are set
  • Better error logging and debugging information

📚 Documentation Updates

  • Update .env.example with auto-enabling behavior notes
  • Update ENVIRONMENT_VARIABLES.md with clarified functionality
  • Add comprehensive tests for duration parsing

This resolves the core issues where:

  1. GITEA_MIRROR_INTERVAL=8h was not working for automatic mirroring
  2. Repository cleanup was not working despite CLEANUP_DELETE_IF_NOT_IN_GITHUB=true
  3. Users had no visibility into why scheduling/cleanup wasn't working

🤖 Generated with Claude Code


🔄 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/77 **Author:** [@arunavo4](https://github.com/arunavo4) **Created:** 8/20/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `issue-72` --- ### 📝 Commits (5) - [`698eb0b`](https://github.com/RayLabsHQ/gitea-mirror/commit/698eb0b507881aeeb1d88b49fbeb4832aa9c3189) fix: Complete Issue #72 - Fix automatic mirroring and repository cleanup - [`38a0d1b`](https://github.com/RayLabsHQ/gitea-mirror/commit/38a0d1b494e6a51faf3ca4a5d51276beb28e24ec) repository cleanup functionality - [`fe94d97`](https://github.com/RayLabsHQ/gitea-mirror/commit/fe94d97779d4a1c858004c28a7c63d7e19900a03) Issue 68 - [`926737f`](https://github.com/RayLabsHQ/gitea-mirror/commit/926737f1c58412e93c39dce9d62297c0dfef84e3) Added a few new features. - [`12ee065`](https://github.com/RayLabsHQ/gitea-mirror/commit/12ee06583316b6fdd9e52238278b6ddabc84fd4e) Docs updated | added some options ### 📊 Changes **21 files changed** (+1561 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `.env.example` (+2 -2) 📝 `CHANGELOG.md` (+48 -0) 📝 `CLAUDE.md` (+18 -0) 📝 `README.md` (+29 -1) 📝 `docker-entrypoint.sh` (+2 -2) 📝 `docs/ENVIRONMENT_VARIABLES.md` (+4 -3) 📝 `src/components/config/ConfigTabs.tsx` (+9 -4) 📝 `src/components/config/MirrorOptionsForm.tsx` (+26 -0) 📝 `src/lib/auth.ts` (+27 -8) 📝 `src/lib/db/schema.ts` (+3 -0) 📝 `src/lib/env-config-loader.ts` (+7 -3) 📝 `src/lib/gitea.ts` (+203 -62) ➕ `src/lib/repository-cleanup-service.ts` (+373 -0) ➕ `src/lib/scheduler-service.ts` (+286 -0) 📝 `src/lib/utils/config-mapper.ts` (+2 -1) ➕ `src/lib/utils/duration-parser.test.ts` (+94 -0) ➕ `src/lib/utils/duration-parser.ts` (+251 -0) 📝 `src/middleware.ts` (+42 -0) ➕ `src/pages/api/cleanup/trigger.ts` (+130 -0) 📝 `src/types/Repository.ts` (+4 -0) _...and 1 more files_ </details> ### 📄 Description Major fixes for Docker environment variable issues and cleanup functionality: 🔧 **Duration Parser & Scheduler Fixes** - Add comprehensive duration parser supporting "8h", "30m", "24h" formats - Fix GITEA_MIRROR_INTERVAL environment variable mapping to scheduler - Auto-enable scheduler when GITEA_MIRROR_INTERVAL is set - Improve scheduler logging to clarify timing behavior (from last run, not startup) 🧹 **Repository Cleanup Service** - Complete repository cleanup service for orphaned repos (unstarred, deleted) - Fix cleanup configuration logic - now works with CLEANUP_DELETE_IF_NOT_IN_GITHUB=true - Auto-enable cleanup when deleteIfNotInGitHub is enabled - Add manual cleanup trigger API endpoint (/api/cleanup/trigger) - Support archive/delete actions with dry-run mode and protected repos 🐛 **Environment Variable Integration** - Fix scheduler not recognizing GITEA_MIRROR_INTERVAL=8h - Fix cleanup requiring both CLEANUP_DELETE_FROM_GITEA and CLEANUP_DELETE_IF_NOT_IN_GITHUB - Auto-enable services when relevant environment variables are set - Better error logging and debugging information 📚 **Documentation Updates** - Update .env.example with auto-enabling behavior notes - Update ENVIRONMENT_VARIABLES.md with clarified functionality - Add comprehensive tests for duration parsing This resolves the core issues where: 1. GITEA_MIRROR_INTERVAL=8h was not working for automatic mirroring 2. Repository cleanup was not working despite CLEANUP_DELETE_IF_NOT_IN_GITHUB=true 3. Users had no visibility into why scheduling/cleanup wasn't working 🤖 Generated with [Claude Code](https://claude.ai/code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 15:55:13 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gitea-mirror#122
No description provided.