Git finalize pr
Skill ainova-systems/intelligence-dev-packs/packs/core/skills/git-finalize-pr
Intelligence pack for software engineering based on Ainova Systems best practices
npx -y skills add ainova-systems/intelligence-dev-packs --skill git-finalize-prAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Drive the current branch's PR to merge-ready: CI green and every review comment handled, ending with an outcome label
SKILL.md
3.1 KB, as published. Nobody here has run it
Finalize the PR
Take a freshly pushed PR through fix/push iterations until CI is green AND every review comment is answered - merge-ready for the owner's accept. Runs autonomously across CI rounds (typically 15-30 min each); wait reactively, never busy-poll.
Pre-flight
git branch --show-current- abort on the default/integration/protected branch.- Resolve the PR:
gh pr list --head <branch> --state open --json number --jq '.[0].number'. An explicit argument must match this branch's PR. None - open it withgit-open-prfirst, then retry. - Latest commit:
git rev-parse HEAD. Every check below filters runs byheadSha == HEAD; stale runs for older commits are ignored.
Loop 1 - CI to green
- Probe:
gh pr checks <pr>plusgh run list --branch <branch> --limit 8 --json databaseId,headSha,name,status,conclusion. - Decide:
- all latest-SHA workflows
success- proceed to Loop 2; - any
in_progress/queued- wait, sized to the longest job's typical duration; - any latest-SHA
failure- drill in.
- all latest-SHA workflows
- Drill in: failed step via
gh run view <run_id> --json jobs --jq '.jobs[] | select(.conclusion == "failure")'; log viagh run view --job <job_id> --log(fallbackgh api repos/{owner}/{repo}/actions/jobs/<job_id>/logswhile sibling jobs still run). Find the root-cause file:line; read it and the surrounding code. - Fix smallest-correct, top-down (what happened - what changed since last green - fix or delete per the feature doc - existing primitive?). Run the relevant local gates (
dev-run-tests) before pushing. Batch multi-file fixes into one commit so concurrency cancels prior runs cleanly. - Push, repeat from 1.
Loop 2 - comments drained
- Fetch unresolved threads: GraphQL
reviewThreads(first: 100) { nodes { id isResolved comments(first: 1) { nodes { path line body author { login } } } } }; plusgh pr view <pr> --json reviews,comments. - Process via
git-review-pr-comments: fix / discuss / decline-with-reason; reply to every thread. - New pushes restart Loop 1; repeat until green AND drained.
Outcome
Exactly one label, then report (PR URL, label, what needs the owner):
ai:ready-to-merge- green, comments drained,mergeable: MERGEABLE;ai:manual- needs an owner decision (state precisely which);ai:failed- cannot reach green (state the blocking failure and what was tried).
Verify
gh pr checks <pr>all green on HEAD; zero unresolved threads; exactly oneai:*label on the PR.
Scope / hand-off
- Merging -
git-merge-prafter the owner accepts. mergeable: CONFLICTING-git-resolve-conflicts, then back into Loop 1.
CRITICAL
- Fix the cause, never the gate: no skipped tests, no loosened checks, no retry-until-green on flaky failures - flag flakes explicitly.
- A failure that already exists on the target branch is reported as pre-existing, never "fixed" on this PR.
- Never merge from this skill, even when everything is green.