Automated sync for mirroring GitHub repositories to greptileai/*-mirror repos.
Every 30 minutes, this workflow syncs configured repositories in parallel:
- Syncs all branches - Force-pushes all branches from upstream
- Syncs tags - Pushes all tags from upstream
- Syncs labels - Copies labels from upstream repo
- Syncs PRs - For every open PR on upstream:
- Creates a corresponding branch on the mirror
- Creates a corresponding PR with the same title and description
- Updates branches when upstream PRs are updated
- Closes mirror PRs when upstream PRs are closed/merged
- Edit
repos.yamland add a new entry:
repos:
- name: react
upstream: facebook/react
mirror: greptileai/react-mirror
excluded_prs: [32222]
- name: nextjs # Add your repo
upstream: vercel/next.js
mirror: greptileai/nextjs-mirror
excluded_prs: []-
Create the mirror repository on GitHub (e.g.,
greptileai/nextjs-mirror) -
Ensure your
MIRROR_PAThas access to the new mirror repo -
Commit and push - the workflow will start syncing on the next run
| Field | Description |
|---|---|
name |
Short identifier for logging |
upstream |
Source repository (e.g., facebook/react) |
mirror |
Destination repository (e.g., greptileai/react-mirror) |
excluded_prs |
List of PR numbers to skip (e.g., branch name collisions) |
Create a PAT with the following permissions:
repo(full control of private repositories)workflow(update GitHub Action workflows)
The PAT must have access to all mirror repositories under greptileai/.
Add the PAT as a repository secret named MIRROR_PAT:
- Go to this repo's Settings > Secrets and variables > Actions
- Click "New repository secret"
- Name:
MIRROR_PAT - Value: Your PAT
The workflow runs automatically every 30 minutes. You can also trigger it manually from the Actions tab.
Go to Actions > "Sync Mirror Repos" > "Run workflow"
repos.yaml # Central config defining all repo pairs
|
sync.yml (matrix strategy) # GitHub Actions runs jobs in parallel
|
sync_mirror.py (parameterized) # Python script accepts repo config as args
- Jobs run in parallel (up to 5 concurrent) with
fail-fast: false - One repo failure doesn't affect others
- Each sync job is independent (no shared state)