Mirrors configured repositories to the dune-mirrors org.
Mirrors last updated at: never
The repositories to be mirrored are defined in repos.json. This file contains a JSON object mapping repository names to their GitLab URLs. To add or remove repositories from the mirroring process, simply edit this file and push your changes to trigger an update.
Example format:
{
"repository-name": "https://gitlab.dune-project.org/path/to/repository.git"
}The mirroring process is implemented as a GitHub Actions workflow defined in .github/workflows/mirrorer.yml. The workflow operates as follows:
-
Trigger: The workflow runs:
- Automatically every day at midnight (via cron schedule)
- Manually when triggered via GitHub's workflow_dispatch
- On push to the repository (e.g., when updating
repos.json)
-
Repository Matrix Generation:
- The workflow first runs a job that executes
repos_to_matrix.py - This script reads
repos.jsonand converts it to a format suitable for GitHub Actions' matrix strategy - Each repository is processed with its name, URL, and a keyname (used for SSH key reference)
- The workflow first runs a job that executes
-
Mirroring Process:
- For each repository in the matrix, a separate job runs in parallel
- The job mints a short-lived installation token from the DUNE Mirrorer GitHub App
(its private key is stored in the
DUNE_MIRRORER_PRIVATE_KEYsecret), scoped to just the target mirror repository - It clones the GitLab repository with
--mirroroption to get all branches and tags - Sets the push URL to the corresponding repository in the dune-mirrors GitHub organization
- Removes the GitLab merge-request references (which GitHub rejects on push)
- Pushes all branches and tags to GitHub with
--mirroroption, authenticating with the App token
Pushes to the dune-mirrors org are authenticated with the DUNE Mirrorer GitHub App
rather than per-repository SSH deploy keys. The App must be installed on the organization
with Contents: write permission and granted access to the mirror repositories. Only its
private key (the DUNE_MIRRORER_PRIVATE_KEY Actions secret) needs to be configured.
This project uses pyproject.toml for dependency management. The required dependencies are:
- requests: For making HTTP requests to the GitHub API
- python-dotenv: For loading environment variables from .env files
To install the dependencies, you can use pip:
# Install the base dependencies
pip install -e .
# For development (includes testing and linting tools)
pip install -e ".[dev]"- Add/Remove Repositories: Edit
repos.jsonand push changes - Manual Trigger: Use the "Run workflow" button in the Actions tab of the GitHub repository
- Automatic Updates: The workflow runs daily to ensure mirrors stay up-to-date
To run the scripts locally:
-
Create a
.envfile with your GitHub token:GITHUB_TOKEN=your_github_token -
Run the infrastructure setup script (ensures each mirror repo exists in the org; authentication for pushes is handled by the DUNE Mirrorer GitHub App):
python infra_setup.py
-
Generate the repository matrix:
python repos_to_matrix.py