check-ci
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseCheck CI
CI检查监控
Overview
概述
This skill provides automated monitoring of GitHub Pull Request CI checks. It polls PR check status at regular intervals and reports when checks pass, fail, or timeout, enabling continuous integration workflow automation.
该Skill可自动监控GitHub Pull Request(PR)的CI检查。它会定期轮询PR检查状态,并在检查通过、失败或超时时进行报告,从而实现持续集成工作流的自动化。
When to Use This Skill
何时使用该Skill
Trigger this skill when the user requests:
- Checking CI status for a PR
- Monitoring CI checks until completion
- Waiting for CI to pass before proceeding
- Verifying build status
- Polling GitHub PR checks with custom intervals or timeouts
当用户提出以下请求时触发该Skill:
- 检查PR的CI状态
- 监控CI检查直至完成
- 在继续后续操作前等待CI通过
- 验证构建状态
- 自定义轮询间隔或超时时间来轮询GitHub PR检查
Core Workflow
核心工作流
1. Execute CI Polling
1. 执行CI轮询
Run the script to monitor PR checks:
check_ci.shbash
bash scripts/check_ci.sh [PR_NUMBER] [INTERVAL] [TIMEOUT]Parameters:
- (optional): PR number to monitor. Auto-detects from current branch if not provided
PR_NUMBER - (optional, default: 15): Seconds between polling attempts
INTERVAL - (optional, default: 600): Maximum wait time in seconds
TIMEOUT
Examples:
bash
undefined运行脚本以监控PR检查:
check_ci.shbash
bash scripts/check_ci.sh [PR_NUMBER] [INTERVAL] [TIMEOUT]参数说明:
- (可选):要监控的PR编号。如果未提供,将自动从当前分支检测
PR_NUMBER - (可选,默认值:15):轮询尝试之间的时间间隔(秒)
INTERVAL - (可选,默认值:600):最长等待时间(秒)
TIMEOUT
示例:
bash
undefinedAuto-detect PR from current branch
从当前分支自动检测PR
bash scripts/check_ci.sh
bash scripts/check_ci.sh
Monitor specific PR #123
监控特定PR #123
bash scripts/check_ci.sh 123
bash scripts/check_ci.sh 123
Custom interval (30s) and timeout (15 min)
自定义间隔(30秒)和超时时间(15分钟)
bash scripts/check_ci.sh 123 30 900
undefinedbash scripts/check_ci.sh 123 30 900
undefined2. Interpret Results
2. 解读结果
The script returns three possible outcomes:
✅ Success (exit code 0): All CI checks passed
- Indicate that the PR is green and ready for next steps
- Suggest proceeding with merge, review, or deployment
❌ Failure (exit code 1): One or more CI checks failed
- Parse the output to identify specific failing checks
- Analyze failure patterns (test failures, lint errors, build issues)
- Suggest concrete fixes based on the failure type:
- Test failures: Review test output, fix failing tests
- Lint errors: Run linter locally, apply fixes
- Build failures: Check compilation errors, dependencies
- Type errors: Review type definitions, fix type issues
⏰ Timeout (exit code 2): Polling exceeded timeout limit
- Suggest running with longer timeout:
check_ci.sh [PR] [interval] [longer_timeout] - Recommend checking GitHub directly for CI status
- Consider whether CI is actually running or stuck
脚本会返回三种可能的结果:
**✅ 成功(退出码0):**所有CI检查均通过
- 表示PR已通过检查,可进行后续步骤
- 建议继续进行合并、评审或部署操作
**❌ 失败(退出码1):**一项或多项CI检查失败
- 解析输出来确定具体失败的检查项
- 分析失败模式(测试失败、代码规范检查错误、构建问题)
- 根据失败类型提供具体修复建议:
- 测试失败:查看测试输出,修复失败的测试用例
- 代码规范检查错误:在本地运行代码规范检查工具,应用修复
- 构建失败:检查编译错误、依赖项问题
- 类型错误:查看类型定义,修复类型问题
**⏰ 超时(退出码2):**轮询超出超时限制
- 建议使用更长的超时时间运行:
check_ci.sh [PR] [interval] [longer_timeout] - 推荐直接在GitHub上查看CI状态
- 确认CI是否真的在运行或已卡住
3. Provide Actionable Summary
3. 提供可执行的总结
Structure the response as follows:
markdown
undefined按以下结构整理响应内容:
markdown
undefinedCI Polling Results for PR #[number]
PR #[number]的CI轮询结果
Final Status
最终状态
[✅ All checks passed / ❌ Checks failed / ⏰ Polling timed out]
[✅ 所有检查已通过 / ❌ 检查失败 / ⏰ 轮询超时]
Polling Summary
轮询摘要
- Duration: [time]
- Final state: [description]
- Specific failures: [if applicable]
- 持续时间:[时长]
- 最终状态:[描述]
- 具体失败项:[如有适用]
Next Steps
下一步操作
[Specific actions based on results]
undefined[基于结果的具体操作建议]
undefinedAdvanced Usage
高级用法
Auto-Detection Requirements
自动检测要求
For PR auto-detection to work:
- Must be in a git repository
- Current branch must have an associated PR
- GitHub CLI () must be authenticated
gh
要实现PR自动检测,需满足以下条件:
- 当前处于git仓库中
- 当前分支已关联PR
- GitHub CLI ()已完成身份验证
gh
Error Handling
错误处理
No PR found:
- Verify current branch has an associated PR:
gh pr view - Suggest creating a PR if none exists
- Check if branch is pushed to remote
GitHub CLI issues:
- Verify is installed and authenticated
gh - Check repository access permissions
- Ensure network connectivity
未找到PR:
- 验证当前分支是否已关联PR:
gh pr view - 如无PR,建议创建一个
- 检查分支是否已推送到远程仓库
GitHub CLI问题:
- 验证是否已安装并完成身份验证
gh - 检查仓库访问权限
- 确保网络连接正常
Integration with Other Workflows
与其他工作流集成
This skill complements:
- PR creation workflows (check CI after pushing)
- Code review processes (verify CI before reviewing)
- Deployment pipelines (ensure CI passes before deploy)
- Automated testing workflows
该Skill可与以下工作流互补:
- PR创建工作流(推送代码后检查CI)
- 代码评审流程(评审前验证CI状态)
- 部署流水线(部署前确保CI已通过)
- 自动化测试工作流
Resources
资源
scripts/check_ci.sh
scripts/check_ci.sh
Bash script that performs the actual CI polling. The script:
- Auto-detects PR number from current branch or accepts as argument
- Auto-detects repository owner/name from git remote
- Polls at configurable intervals
gh pr checks - Returns appropriate exit codes for success/failure/timeout
- Provides real-time status updates during polling
The script can be executed directly without loading into context, making it token-efficient for repeated CI monitoring operations.
执行实际CI轮询的Bash脚本。该脚本具备以下功能:
- 从当前分支自动检测PR编号,或接受参数传入
- 从git远程仓库自动检测仓库所有者/名称
- 按可配置的时间间隔轮询
gh pr checks - 返回对应成功/失败/超时的退出码
- 轮询期间提供实时状态更新
该脚本可直接执行,无需加载到上下文,因此在重复进行CI监控操作时具备高效的token使用效率。