Skip to content

feat: implement GitHub to Forgejo/Codeberg repository mirroring#1

Merged
guilycst merged 15 commits into
mainfrom
feature/mirror-github-to-forgejo
Mar 17, 2026
Merged

feat: implement GitHub to Forgejo/Codeberg repository mirroring#1
guilycst merged 15 commits into
mainfrom
feature/mirror-github-to-forgejo

Conversation

@guilycst
Copy link
Copy Markdown
Owner

Summary

Implements gitmeout - a Go CLI tool that mirrors repositories from GitHub to Forgejo/Codeberg instances.

Features

  • Mirror types: Supports both push and pull mirrors
    • Push mirrors: Clone from source, push --mirror to target (for Codeberg)
    • Pull mirrors: Use Forgejo MigrateRepo API (for vanilla Forgejo instances)
  • Filtering:
    • Personal repos (default)
    • Organization repos
    • Explicit repo list with owner/* wildcard support
  • Graceful shutdown: Context cancellation support
  • Multiarch Docker: linux/amd64, linux/arm64
  • CI/CD: GitHub Actions for testing and releases
  • Kubernetes: Job and CronJob manifests

Configuration

YAML config with environment variable interpolation:

source:
  type: github
  token: ${GITHUB_TOKEN}
  filters:
    personal: true
    orgs: []
    repos: []

targets:
  - name: codeberg
    type: forgejo
    url: https://codeberg.org
    token: ${CODEBERG_TOKEN}
    mirror_type: push
  - name: decastro
    type: forgejo
    url: ${DECASTRO_URL}
    token: ${DECASTRO_TOKEN}
    mirror_type: pull

Files Added

  • .github/workflows/ci.yml - CI pipeline (test, lint)
  • .github/workflows/release.yml - Release pipeline (binaries + Docker multiarch)
  • cmd/gitmeout/main.go - Entry point
  • internal/config/ - YAML config parsing with env interpolation
  • internal/git/client.go - Git clone/push operations
  • internal/mirror/service.go - Core mirroring logic
  • internal/source/github/client.go - GitHub API client
  • internal/target/forgejo/client.go - Forgejo API client
  • deploy/k8s/ - Kubernetes manifests

Testing

All tests passing:

✓ 25 tests in 6 packages

Tested locally with both push (Codeberg) and pull (vanilla Forgejo) mirrors.

guilycst added 15 commits March 17, 2026 00:56
- Add support for both push and pull mirror types
- Push mirrors: clone from source, push --mirror to target
- Pull mirrors: use Forgejo MigrateRepo API
- Support filtering by personal repos, orgs, or explicit repo list
- Support owner/* wildcard for mirroring all repos from an owner
- Graceful shutdown with context cancellation
- Multiarch Docker builds (linux/amd64, linux/arm64)
- CI/CD for releases to GHCR and Forgejo registry
- Kubernetes Job and CronJob manifests

Configuration is via YAML with environment variable interpolation.
Authentication uses tokens for both GitHub and Forgejo/Codeberg.
@guilycst guilycst self-assigned this Mar 17, 2026
@guilycst guilycst merged commit e260516 into main Mar 17, 2026
3 checks passed
@guilycst guilycst deleted the feature/mirror-github-to-forgejo branch March 17, 2026 04:36
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.

1 participant