Check PR
Analyze a pull request (GitHub), merge request (GitLab), or shelved changelist (Perforce) for review comments, status checks, and description completeness, then help address any issues found.
Inputs
- PR/MR/CL number (optional): If not provided, detect the PR/MR for the current branch, or the default pending changelist for p4.
Instructions
0. Detect platform
First check if the user is working in a Perforce depot by looking for a .p4config file or P4CLIENT/P4PORT environment variables:
# Check for Perforce environment
if p4 info >/dev/null 2>&1; then
VCS="perforce"
else
# Fall back to git remote detection
REMOTE_URL=$(git remote get-url origin)
if echo "$REMOTE_URL" | grep -qi "gitlab"; then
VCS="gitlab"
else
VCS="github"
fi
fi
For self-hosted GitLab instances whose hostname doesn't contain "gitlab", the user can override by passing --vcs gitlab as an input. For Perforce, the user can override by passing --vcs perforce.
1. Identify the PR/MR/CL
If a number was provided, use it. Otherwise, detect it:
GitHub:
gh pr view --json number,headRefName,headRefOid -q '{number: .number, branch: .headR…