wl/GithubCodebergMirror
11
23
Fork
You've already forked GithubCodebergMirror
3
Continuously mirrors issues, pull requests, milestones, and branches bidirectionally between Codeberg and Github.
  • Java 97.7%
  • Shell 2%
  • Makefile 0.3%
Find a file
2026年01月04日 17:37:44 +01:00
modules Initial commit 2023年04月13日 12:24:22 +02:00
wl/mirrorbot Fix PR sorting order 2026年01月04日 17:37:44 +01:00
.clang-format Formatting and package structure 2024年11月13日 22:25:35 +01:00
.gitignore Formatting and package structure 2024年11月13日 22:25:35 +01:00
git.sh Retry without erroring out when git fetch fails 2025年10月28日 15:37:43 +01:00
icon.png Basic issue and comment creation 2023年04月13日 14:52:02 +02:00
install-hook.sh Formatting and package structure 2024年11月13日 22:25:35 +01:00
LICENSE Added license 2023年04月14日 22:05:05 +02:00
Makefile Formatting and package structure 2024年11月13日 22:25:35 +01:00
muninconf Use GB instead of MB 2025年07月16日 12:21:26 +02:00
README.md Make release syncing optional 2025年09月04日 12:45:14 +02:00
run.sh Add run convenience file 2023年04月15日 16:19:21 +02:00

GitHub / Codeberg Mirror

This provides a bot to periodically sync our development environments at Codeberg and GitHub. The purpose of the system is to allow contributors to use GitHub and Codeberg interchangeably, or only either one of the two, at each contributor's choice.

The bot mirrors PRs, Issues, Branches, Milestones, Labels, Releases, and CI workflow results. It does not mirror Reactions, Commit comments, Discussions, Projects, and repository settings.

The bot also provides a merge bot to merge PRs automatically as soon as all requirements are met. It is strongly discouraged to merge PRs directly instead of using the merge bot.

The bot is assumed to always run as the same bot user who uses the same account name on both services.

Before use, create a config.json file to list the bot's Personal Access Tokens for both services, and the mappings for the repositories. Example:

{
	"botname": "bot-user-name", /* The bot user's username. */
	"mirrored-since": "2023年01月01日T00:00:00Z", /* Treat bot activity before this timestamp as regular activity. */
	"dryrun": false, /* If you're just testing and don't actually want to commit any changes. */
	"max-detailed-ci-results": 2, /* Maximum number of detailed logs for failing CI checks. */
	"Codeberg-PAT": "abcdef123456", /* The bot's personal access token for Codeberg. */
	"GitHub-PAT": "987654fedcba", /* The bot's personal access token for GitHub. */
	"email": ["hello.world@example.com"], /* List of addresses who receive notifications about fatal errors. */
	"mirrors": [ /* List of repos to mirror. */
		{
			"Codeberg-Org": "my-org", /* Name of the organization that owns the Codeberg repo. */
			"Codeberg-Repo": "my-repo", /* Name of the repo on Codeberg. */
			"GitHub-Org": "other-org", /* Name of the organization that owns the GitHub repo. */
			"GitHub-Repo": "other-repo", /* Name of the repo on GitHub. */
			"issues": true, /* Whether to mirror issues. */
			"releases": true, /* Whether to mirror releases. */
			"huge": false, /* Repos with >30000 comments need special handling. */
			"ci": true, /* Whether to expect CI checksuite results. */
			"format": "./fix_formatting.sh", /* Command to reformat branches; may be null. */
			"path": "/home/foo/repo-checkout", /* Path to the git checkout of this repo. */
			"branches": ["master"] /* List of branches to sync always. */
		}
	]
}

Compile and start the bot directly using

make run

or as a daemon process using

./run.sh

This requires a Java Development Kit. Optionally curl is required.

sudo apt-get install openjdk-17-jdk curl