autoresolving-pr-conflicts

Resolves merge conflicts on open GitHub pull requests by merging master and pushing one merge commit.

713|118|Updated Aug 11, 2020
One-click install
npx skills add https://github.com/PostHog/posthog-foss --skill autoresolving-pr-conflicts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: autoresolving-pr-conflicts
Source: https://github.com/PostHog/posthog-foss/tree/main/.agents/skills/autoresolving-pr-conflicts
Command: npx skills add https://github.com/PostHog/posthog-foss --skill autoresolving-pr-conflicts

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve?

Open pull requests that conflict with master stall until a human manually rebases or merges, and unattended automation often flattens merges or blindly picks one side. This Skill defines a conservative, unattended sweep that finds conflicting PRs, resolves safe conflicts, and flags everything else for a human.

Core Features & Use Cases

  • Conflict sweep: Lists open, non-draft, same-repo PRs targeting master, checks each with git merge-tree, and processes at most 10 per run, newest first.
  • Safe resolution: Resolves source conflicts with judgment, regenerates lockfiles and generated artifacts deterministically inside a credentialless Docker container, and lands exactly one two-parent merge commit on the PR head branch.
  • Attempt deduplication: Tracks each attempt with a sticky marker comment keyed to the head and master OIDs, so unchanged conflicts are never retried.
  • Use Case: A scheduled hourly routine sweeps PostHog/posthog, auto-resolves a PR whose only conflict is pnpm-lock.yaml, pushes the merge commit, and posts a review-before-merging comment.

Quick Start

Ask the agent to read .agents/skills/autoresolving-pr-conflicts/SKILL.md and execute exactly one conflict sweep against the repository's open pull requests.

Frequently Asked Questions about autoresolving-pr-conflicts

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

FAQPage Schema
How do I automatically resolve merge conflicts on GitHub pull requests?

Run one sweep as defined in SKILL.md: list open PRs with gh, detect conflicts with git merge-tree, merge origin/master into each head branch, resolve conflicts, and push a single merge commit. PRs needing uncertain judgment are flagged for a human instead.

How are lockfile and generated-code conflicts resolved?

Generated artifacts like pnpm-lock.yaml, uv.lock, and generated frontend types are never hand-edited. They are regenerated deterministically inside a disposable, credentialless Docker container, and only files matching the generated-artifact globs are copied back.

Can the sweep push to protected or fork branches?

No. It writes only to head branches of open, non-draft, same-repo PRs targeting master, and never to master, forks, or agent-owned branches. A refused push is treated as a protected branch and flagged for a human.

Why does the resolution use a merge commit instead of rebasing?

History is never rewritten: no force-push and no amend. The resolution must be one new commit recording both the PR head and origin/master as parents, because flattening the merge inflates the PR's diff with every file master touched.

How does the sweep avoid retrying the same conflict?

Each attempt is recorded in a sticky PR comment ending with a marker containing the head and master OIDs. PRs whose marker matches the current state are skipped, and all marker reads and writes go through the validated autoresolve-marker.sh helper.

What happens when Docker is unavailable for artifact regeneration?

The sweep never falls back to running PR-controlled tooling in the credentialed session. Source conflicts may still be resolved, but any PR needing regenerated artifacts is flagged for a human with the reason noted.