AgentSkillsCN

fetch-bugfix-prs

从 GitHub 仓库中提取带有关联问题的漏洞修复 PR。适用于被要求查找修复漏洞的 PR 时使用,尤其是在需要分析 PR 与其关联问题之间的关系时。

SKILL.md
--- frontmatter
name: fetch-bugfix-prs
description: Fetch bug-fix PRs with linked issues from a GitHub repository. Use this when asked to find PRs that fix bugs, especially when needing to analyze the relationship between PRs and their linked issues.

Fetch Bug-Fix PRs Skill

This skill fetches pull requests that are bug fixes with linked issues from a GitHub repository.

Usage

Run the fetch.sh script with the following parameters:

bash
./fetch.sh --repo <owner/repo> --since <YYYY-MM-DD> --until <YYYY-MM-DD> [--author <username>] [--output <path>]

Parameters

ParameterRequiredDescriptionExample
--authorNoGitHub username of the PR authorosortega
--repoYesRepository in owner/repo formatmicrosoft/vscode
--sinceYesStart date (inclusive)2025-12-02
--untilYesEnd date (inclusive)2026-02-02
--outputNoOutput file path (default: data/prs-with-issues.md)./results.md

Example

bash
# Fetch all bug-fix PRs from the last 2 months
./.github/skills/fetch-bugfix-prs/fetch.sh \
   --repo microsoft/vscode \
   --since 2025-12-02 \
   --until 2026-02-02

# Fetch Osvaldo's bug-fix PRs from the last 2 months
./.github/skills/fetch-bugfix-prs/fetch.sh \
   --author osortega \
   --repo microsoft/vscode \
   --since 2025-12-02 \
   --until 2026-02-02

Output Format

The script generates a markdown file with a table:

PR #PR TitleIssue #Issue TitleMerge CommitParent CommitLabels

How It Works

  1. Uses gh CLI to search for PRs by author in the date range
  2. Filters for bug fixes by checking:
    • Labels containing "bug", "fix", or "regression"
    • Title containing "fix", "fixes", "fixed", "resolve", "closes"
  3. Extracts linked issues from:
    • PR title (e.g., "Fixes #12345")
    • PR body (GitHub issue references)
    • Timeline events (linked issues via GitHub UI)
  4. Fetches issue details for each linked issue
  5. Gets merge commit and its parent for each PR

Prerequisites

  • gh CLI installed and authenticated
  • jq for JSON processing