Files
Andre ecc8aa1c1a feat: synchronize GitHub releases with Gitea
Gitea pull mirrors preserve Git refs but leave release notes and uploaded artifacts outside the backup. Without a separate synchronization path, restoring a repository would still depend on GitHub for important release context and binaries.
2026-08-08 09:26:35 +02:00

31 lines
1.1 KiB
Bash

# Copy to mirror.env and fill in. Contains secrets -- keep at chmod 600.
# mirror.env is git-ignored on purpose; never commit the real file.
# --- GitHub (source) ---
GITHUB_USER=your-github-username
# Fine-grained token: "All repositories" + Contents: Read-only + No expiration.
# Leave empty to mirror public repositories only.
GITHUB_TOKEN=
# --- Gitea (target) ---
# As seen from the machine running this script.
GITEA_URL=http://127.0.0.1:3000
# Create with:
# docker exec -u git <container> gitea admin user generate-access-token \
# --username <user> --token-name github-mirror-sync \
# --scopes write:repository,read:user
GITEA_TOKEN=
GITEA_OWNER=your-gitea-username
# --- Behaviour ---
# How often Gitea pulls from GitHub (Go duration: 24h, 8h, 30m, ...).
MIRROR_INTERVAL=24h
INCLUDE_FORKS=false
INCLUDE_ARCHIVED=true
# Gitea's native mirror only pulls git data. The script separately keeps
# GitHub release metadata and uploaded assets in sync on every cron run.
SYNC_RELEASES=true
SYNC_RELEASE_ASSETS=true
# Set to true to preview without changing anything.
DRY_RUN=false