360 Secure SkillHub
360 安全技能中心

PR Auto-Check

面向新提交 PR 的自动化流水线技能:用 Bash 脚本采集 CI 状态与 diff 统计并做健康校验,结合 code-review 技能审查 PR 差异,最后通过 Discord webhook 把结果推送到频道;依赖 gh、jq、curl 与 Discord webhook 地址。

terrycarter1985
terrycarter1985
热度 56.26
最近更新 2026-06-19 09:10:24
分类:开发依赖:代码执行 / 读写文件 / 第三方 API应用场景:代码审查 / DevOps / 工作流 / 自动化脚本

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pr-auto-check
Metadata
name
pr-auto-check
description
Automated PR submission pipeline: run code review, verify service health, and post the full result to a Discord channel. Use when a new PR is submitted and needs automated review + health validation + team notification. Triggers on: "PR auto check", "check this PR", "PR review pipeline", "run PR checks", "PR提交检查", "自动化PR检查".

PR Auto-Check

Automated pipeline that runs on new PR submission: code review → health check → Discord notification.

Workflow

  1. Run the pipeline script — collects CI status, diff stats, and health check results:

    bash {baseDir}/scripts/pr_auto_check.sh --pr <number> [--repo <owner/repo>] [--json]
    
    • --json: machine-readable output (for piping)
    • Without --json: human-readable report printed to stdout
    • Prints the temp result-file path as the last line (for piping to notification)
  2. Conduct code review — use the code-review skill on the PR diff. Focus on:

    • Critical issues and security findings
    • CI/CD failures (if any)
    • Summarize findings into the report
  3. Post result to Discord:

    bash {baseDir}/scripts/notify_discord.sh --webhook <DISCORD_WEBHOOK_URL> --result <json-file>
    

One-liner (CI/CD integration)

RESULT=$(bash {baseDir}/scripts/pr_auto_check.sh --pr 42 --json) && \
  bash {baseDir}/scripts/notify_discord.sh --webhook "$WEBHOOK" --result "$RESULT"

Required Environment

  • gh CLI authenticated (gh auth login)
  • jq for JSON processing
  • curl for Discord webhook
  • Discord webhook URL (set as DISCORD_WEBHOOK env var or pass --webhook)
  • Optional: healthcheck skill installed for service health validation

Discord Webhook Setup

  1. Server Settings → Integrations → Webhooks → New Webhook
  2. Copy the webhook URL
  3. Set DISCORD_WEBHOOK in your environment or pass via --webhook

Exit Codes (pr_auto_check.sh)

Code Meaning
0 All checks passed
1 CI failures or health warnings
2 Critical health issues

Output Format

See references/output-format.md for the JSON schema.