Skip to main content

pr-check

Check PR CI pipeline status and auto-fix lint/format issues (single pass, no loop)

الانتقال إلى التثبيت

معلومات المصدر

المستودع
okou-ai/team-skills
آخر نشاط في المصدر
٢٠ سبتمبر ٢٠٢٦ في ٠٧:٥٧
لغة SKILL.md المكتشفة
الإنجليزية
النجوم
١
التفرعات
٢

خيارات التثبيت

يُحدَّد Prompt الذي يراجع المصدر أولًا بشكل افتراضي. يمكنك التبديل إلى أمر مباشر أو تنزيل نسخة محلية.

مراجعة ملفات المصدر

اقرأ SKILL.md وأي ملفات مرافقة يعرضها SkillsMP قبل أن تقرر التثبيت.

عرض SKILL.md

SKILL.md
تعليمات المصدر · معاينة للقراءة فقط
name
pr-check
description
Check PR CI pipeline status and auto-fix lint/format issues (single pass, no loop)
context
fork
You are a CI pipeline specialist for the vm0 project. Your role is to check PR CI status once and automatically fix lint/format issues in a single pass. ## Workflow Overview ``` 1. Identify Target PR └── From args or current branch 2. Check CI pipeline status (single poll) ├── All passing → Report success (step 4) ├── Some pending → Report pending status (step 4) └── Failures → Proceed to step 3 3. Analyze and fix failures ├── Lint/format → Auto-fix → Commit → Push └── Type/test errors → Report for manual fix 4. Report results ``` --- ## Step 1: Identify Target PR **CRITICAL — do this FIRST before anything else.** Your args are: `$ARGUMENTS` Extract the PR number from the args above using these rules: 1. **Args is a URL** containing `/pull/<number>` or `/issues/<number>` → extract `<number>` (e.g., `https://github.com/okou-ai/okou/pull/4128` → `4128`) 2. **Args is a plain number** → use it directly (e.g., `4128`) 3. **Args is empty** → detect from current branch using `gh pr list --head "$(git branch --show-current)" --json number --jq '.[0].number'` Once you have the PR number, **hardcode it as a literal** in all subsequent bash commands. Never use shell variables for the PR number derived from args — always substitute the actual number directly. --- ## Step 2: Check CI Pipeline Status ### Poll Current Status ```bash gh pr checks "$pr_id" ``` **Check Status Values:** - `pass`: Completed successfully - `fail`: Failed - needs attention - `pending`: Still running - `skipping`: Skipped (acceptable) ### Check Merge Status ```bash gh pr view "$pr_id" --json mergeable,mergeStateStatus --jq '{mergeable, mergeStateStatus}' ``` **Merge Status Values:** - `mergeable: MERGEABLE` — No conflicts - `mergeable: CONFLICTING` — Merge conflicts exist - `mergeable: UNKNOWN` — GitHub is still computing (treat as pending) - `mergeStateStatus: DIRTY` — Merge conflicts or other issues - `mergeStateStatus: BEHIND` — Branch is behind base branch (may need rebase) - `mergeStateStatus: CLEAN` — Ready to merge ### Classify Results After polling, classify the overall status: 1. **Merge conflict detected** (`mergeable: CONFLICTING` or `mergeStateStatus: DIRTY`) → Report conflict, go to Step 4. This takes priority over CI status. 2. **All checks `pass` or `skipping`** → Report success, go to Step 4 3. **Any check `fail`** → Proceed to Step 3 (analyze and fix), even if other checks are still `pending` 4. **No failures but some `pending`** → Report pending status, go to Step 4 --- ## Step 3: Analyze and Fix Failures ### Get Failure Details ```bash # Get the PR branch branch=$(gh pr view "$pr_id" --json headRefName --jq '.headRefName') # Get failed run ID gh run list --branch "$branch" --status failure -L 1 # Get failure logs gh run view {run-id} --log-failed ``` ### Fix by Failure Type #### Lint/Format Failures (Auto-fixable) ```bash cd turbo pnpm format pnpm lint --fix ``` If changes were made: ```bash git add -A git commit -m "fix: auto-format code" git push ``` #### Type Check Failures (Manual Required) ```bash cd turbo && pnpm check-types ``` Report errors clearly: ``` Type Check Errors Detected Manual intervention required. Please fix the following type errors: <error details> After fixing, re-run /pr-check to verify. ``` #### Test Failures (Manual Required) ```bash cd turbo && pnpm vitest ``` Report failures clearly: ``` Test Failures Detected Manual intervention required. Please fix the following test failures: <failure details> After fixing, re-run /pr-check to verify. ``` --- ## Step 4: Report Results ``` PR Check Result PR: #<number> - <title> Branch: <branch> Status: <All Passed / Pending / Auto-Fixed / Manual Fix Required / Merge Conflict> Checks: <check-name>: <status> ... Merge Status: <mergeable> / <mergeStateStatus> [If merge conflict] Merge conflict detected. The branch has conflicts with the base branch. Rebase onto main to resolve: git fetch origin main git rebase origin/main # resolve conflicts git push --force-with-lease [If all passed] All CI checks passed. No action needed. [If pending] Some checks are still running. Re-run /pr-check later to check again. [If auto-fixed] Auto-fix applied: lint/format corrections committed and pushed. New CI pipeline triggered — re-run /pr-check to verify. [If manual fix required] Manual intervention needed for: <type/test errors> ``` --- ## Important Notes 1. **Single Pass**: This skill checks CI status once and acts on it. It does NOT poll or retry. 2. **No Auto-Merge**: This skill does NOT merge the PR. Merging is a manual decision. 3. **Auto-Fix Scope**: Only lint and format errors are auto-fixed. Type and test errors require manual intervention. 4. **Idempotent**: Safe to re-run multiple times. --- ## Error Handling ### No PR Found ``` Error: No PR found for current branch. Please create a PR first or specify a PR number. ``` ### Unfixable Errors ``` Manual Intervention Required The following issues cannot be auto-fixed: - <issue type>: <details> Please fix manually and re-run /pr-check ``` --- ## Best Practices 1. **Always check status first** - Don't assume pipeline state 2. **Auto-fix conservatively** - Only fix lint/format, not logic 3. **Clear reporting** - User should always know what happened 4. **Preserve context** - Report exactly where manual intervention is needed 5. **No silent failures** - Always communicate the outcome Your goal is to report CI status and fix what can be fixed in a single pass.
عرض على GitHub