sync-production

Merges main into production via the GitHub merges API with conflict pre-checks.

5.0k|1.0k|Updated Apr 15, 2021
One-click install
npx skills add https://github.com/pollinations/pollinations --skill sync-production
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sync-production
Source: https://github.com/pollinations/pollinations/tree/main/.claude/skills/sync-production
Command: npx skills add https://github.com/pollinations/pollinations --skill sync-production

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Promoting code from main to production often requires local checkouts and manual merges, and discovering merge conflicts only after starting the process wastes time. This Skill performs a server-side merge through the GitHub merges API and detects conflicts before attempting anything.

Core Features & Use Cases

  • Server-Side Merge: Creates the merge commit on production via the GitHub merges API without touching your local working tree.
  • Conflict Pre-Check: Uses git merge-tree to detect conflicting paths before merging and exits with a clear list of files to resolve manually.
  • Configurable Branches: Override the repository, base, and head branches through environment variables for staging or other promotion flows.
  • Use Case: After a release is approved on main, run the Skill to fast-track the merge into production; if it conflicts, you get the exact conflicting paths and manual resolution steps instead of a failed deploy.

Quick Start

Ask the AI to sync the main branch into production and report whether the merge succeeded or which files conflict.

Frequently Asked Questions about sync-production

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

FAQPage Schema
How do I merge main into production using the GitHub API?

Run the sync-production.sh script, which calls POST /repos/{owner}/{repo}/merges with the base and head branches. The merge commit is created server-side, so no local checkout or working tree changes are needed.

How to check for merge conflicts before merging branches in git?

Use git merge-tree --write-tree --name-only with the two commit SHAs to simulate the merge without touching the working tree. The script runs this pre-check automatically and lists conflicting paths before attempting the API merge.

What tools are required to run the production sync script?

The script requires the GitHub CLI (gh) authenticated with push access to the production branch, plus jq for parsing API responses and git for fetching refs and running merge-tree. It must be run from the repository root.

Why does the GitHub merges API call fail with branch protection enabled?

Branch protection rules requiring pull requests cause the merges API to reject direct merge commits, producing exit code 3. In that case, open a pull request manually with gh pr create --base production --head main.

Can I sync branches other than main and production?

Yes, set the SYNC_REPO, SYNC_BASE, and SYNC_HEAD environment variables to override the defaults. For example, SYNC_BASE=staging SYNC_HEAD=main merges main into staging in any specified owner/repo.