name: mark-pr-ready description: Promote a draft PR to ready-for-review after CI passes and self-review is clean. Assigns reviewers and adds labels. license: Apache-2.0 metadata: audience: autonomous-agents
Mark PR Ready
Promote a draft PR out of draft status. Only do this when CI is green and self-review found no remaining issues.
Preconditions
- You are on the PR's feature branch.
- CI has passed (check via
gh pr checks <N> --required). - Self-review produced no unresolved findings.
Workflow
Verify CI status:
FAILING=$(gh pr checks <N> --json name,state \ --jq '[.[] | select(.state != "SUCCESS" and .state != "SKIPPED" and .state != "NEUTRAL")]')If the output is not an empty array
[], stop — CI isn't green yet.Mark ready for review:
gh pr ready <N>Request reviewers. Always add the creator of the originating issue as a reviewer — they have the most context on the problem and should sign off on the fix:
ISSUE_AUTHOR=$(gh issue view <issue-N> --json author --jq '.author.login' 2>/dev/null) if [ -n "$ISSUE_AUTHOR" ]; then gh pr edit <N> --add-reviewer "$ISSUE_AUTHOR" 2>/dev/null || true fiThen fall back to CODEOWNERS. GitHub auto-assigns from CODEOWNERS when a draft PR is marked ready (if branch protection requires reviews), so explicit assignment is often unnecessary. If the repo doesn't use branch protection, try to find an owner:
CODEOWNERS_FILE="" for f in .github/CODEOWNERS CODEOWNERS docs/CODEOWNERS; do [ -f "$f" ] && CODEOWNERS_FILE="$f" && break done if [ -n "$CODEOWNERS_FILE" ]; then OWNERS=$(grep -v '^#' "$CODEOWNERS_FILE" | awk '{for(i=2;i<=NF;i++) print $i}' | sort -u | head -3) for owner in $OWNERS; do owner="${owner#@}" gh pr edit <N> --add-reviewer "$owner" 2>/dev/null || true done fiIf reviewer assignment fails (e.g. the issue author can't review their own org's PR, or isn't a collaborator), skip silently.
Add labels:
gh pr edit <N> --add-label "bot-generated"If the original issue had priority labels, propagate them:
ISSUE_LABELS=$(gh issue view <issue-N> --json labels --jq '.labels[].name' 2>/dev/null) for label in $ISSUE_LABELS; do case "$label" in priority*|P0|P1|P2|P3|critical|high|medium|low) gh pr edit <N> --add-label "$label" 2>/dev/null || true ;; esac donePost a short comment noting the PR is ready. Mention what CI checks passed and that self-review found no issues. Write it naturally — vary the wording, don't use a canned phrase.
Notes
- Don't merge the PR. This skill only marks the PR ready — the
coordinator may load
auto-mergenext if the PR qualifies. - If label creation fails (label doesn't exist in the repo), skip silently — don't create labels.
- This skill is typically loaded by the coordinator agent after a
check_suiteorworkflow_runevent with conclusionsuccess.