1
0
Fork
You've already forked GithubCodebergMirror
0
Continuously mirrors issues, pull requests, milestones, and branches bidirectionally between Codeberg and Github.
Java 96.4%
Shell 3.3%
Makefile 0.3%
Find a file
2024年11月08日 21:02:48 +01:00
modules Initial commit 2023年04月13日 12:24:22 +02:00
src Mirror GitHub workflow annotations ( closes #26 ) 2024年11月08日 21:02:48 +01:00
.gitignore stats reporting 2024年08月23日 13:11:09 +02:00
git.sh Add co-authors-trailers to co-authors log 2024年08月14日 09:39:28 +02:00
icon.png Basic issue and comment creation 2023年04月13日 14:52:02 +02:00
LICENSE Added license 2023年04月14日 22:05:05 +02:00
Makefile Specify UTF8 encoding in makefile 2024年02月09日 10:35:59 +01:00
muninconf update stats 2024年08月26日 12:29:28 +02:00
README.md Handle CI-less repos cleanly 2024年07月07日 13:01:06 +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. */
			"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