sync-github

Synchronizes code between internal GitLab and external GitHub via gated cherry-pick workflows.

585|144|Updated Apr 13, 2026
One-click install
npx skills add https://github.com/redai-infra/Relax --skill sync-github
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-github
Source: https://github.com/redai-infra/Relax/tree/main/skills/sync-github
Command: npx skills add https://github.com/redai-infra/Relax --skill sync-github

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Keeping an internal GitLab repository and a public GitHub mirror in sync is error-prone: commits can be duplicated, sensitive internal content can leak, and main-branch history can become non-linear. This Skill enforces a two-phase, human-gated synchronization process with audit checks so only reviewed public changes reach GitHub.

Core Features & Use Cases

  • Two-Phase Gated Sync: Phase A cherry-picks external GitHub PR commits into a GitLab CR branch; Phase B replays merged dev commits onto main and pushes to GitHub only after explicit user confirmation.
  • Automated Planning & Auditing: Scripts detect which GitHub PR commits are already absorbed (via exact SHA, patch-id, or subject matching), check for duplicate top-level definitions, run ruff F811, and scan for secrets with gitleaks.
  • CI Gate Before GitHub Push: Pushes the exact HEAD to a validation branch, triggers the GitHub Actions ci.yml workflow, and requires a successful run with matching headSha before allowing any push to github/main.
  • Use Case: After external contributors merge PRs into github/main, run Phase A to cherry-pick them into a GitLab CR; once the internal CR merges, run Phase B to linearly replay dev commits onto gitlab/main and github/main with full audit output.

Quick Start

Ask the assistant to sync the repository between GitLab and GitHub, stating whether the internal CR has already been merged so it knows which phase to run.

Frequently Asked Questions about sync-github

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync commits from GitHub to an internal GitLab repository?

Run the Phase A workflow: it locates the last absorbed GitHub commit via cherry-pick trailers, lists unabsorbed PR commits with plan_github_to_dev.py, cherry-picks them with -x onto a sync branch, and opens a GitLab CR. Direct pushes to dev and merges of github/main are forbidden.

How do I keep main branch history linear when mirroring GitLab to GitHub?

Phase B replays BASE..gitlab/dev commits onto main using git cherry-pick -x in chronological order, skipping sync merges and internal merge nodes. Squashing and merge commits on main are prohibited, preserving a linear, auditable history.

Can I push directly to github/main without running CI first?

No. The same HEAD must first be pushed to a validation branch, the ci.yml workflow triggered via gh workflow run, and the run must conclude success with headSha matching the local HEAD. Each github/main push additionally requires explicit user confirmation.

What happens if gitleaks is not installed during the sync?

The workflow stops and reads references/gitleaks.md, which covers Homebrew installation on macOS, a Docker-based fallback scan, and building from Go source. The user must confirm the installation approach before the secret scan and sync continue.

Why does the sync stop when tracked files have local modifications?

A dirty tracked working tree risks losing uncommitted work during checkout, cherry-pick, or reset operations. The skill halts and lists the modified files; only untracked files are recorded and the sync continues without touching them.

What are the limitations of the plan_github_to_dev.py script?

The script is read-only and matches commits via exact SHA, patch-id, or subject-plus-date heuristics. It can report false positives when commits were absorbed through equivalent rewrites, so human audit results take precedence over its not-in-dev reports.