GitHub-Actions-mirror-repository: The Automation Exoskeleton
How a detached hub uses SSH keys and cron jobs to bring modern automated builds to a legacy C compiler without altering its source code.
- The manager repository pattern isolates modern CI/CD configuration from a pristine legacy codebase.
- Cross-compilation workflows transform standard Linux runners into automated Windows build farms without custom hardware.
- A programmatic keep-alive hack prevents GitHub from silently disabling the automation infrastructure.
The YAML Pollution Problem
Modernizing legacy open-source projects presents a philosophical dilemma. Developers expect automated binaries and GitHub Releases. But foundational projects like the Tiny C Compiler (TCC), hosted entirely outside the GitHub ecosystem, lack these features.
Bolting GitHub Actions directly into a mirror branch creates messy merge conflicts and pollutes the original commit history. The maintainers needed a way to provide modern amenities without corrupting the source of truth.
Architecture of a Shadow Repo
The solution is a strict separation of concerns. The maintainer created a detached "manager" repository that acts as a pure orchestrator. It uses a cron schedule to pull the active development branch from the upstream host.
Once the code is pulled, the manager pushes it to a separate GitHub mirror. It uses stored SSH private keys to bypass default token limitations, maintaining a cryptographically clean 1:1 clone of the original code.
Cross-Compiling on Borrowed Hardware
The exoskeleton does more than just mirror code. It actively provisions infrastructure. The release workflow downloads the freshly synced code and provisions a standard Ubuntu runner.
Using the mingw-w64 toolchain, the Linux environment cross-compiles native Windows binaries. This capitalizes on the extreme portability of C, turning cheap Linux compute into a dedicated Windows build farm.
we use tcc for serious (production) work - as a JIT to build performance critical parts that aren't appropriate to build in the scripting language that the rest of tha 300k line codebase is built in
Outsmarting the Platform Reaper
GitHub aggressively disables scheduled workflows in repositories that lack recent commits. Because this manager repository is designed to be "set it and forget it," it faces a constant risk of being shut down.
To survive, the project uses a keep-alive workflow. This specialized composite action programmatically pings the GitHub API, resetting the timeout clock and ensuring the automation never sleeps.
Monorepo vs. Exoskeleton
The industry standard is to keep CI/CD configuration directly alongside source code. But for mirrors and legacy preservation, the exoskeleton pattern proves superior.
| Feature | Inline CI/CD | Detached Manager Repo |
|---|---|---|
| Codebase Cleanliness | Polluted with .github folders | Pristine 1:1 upstream match |
| Maintenance | Simple single-repo updates | Requires SSH key management |
| Upstream Compatibility | Causes merge conflicts on pull | Zero impact on source history |