Skip to content

Label a PR's type, size, and risk with classify_pull_request

Apply type:*, size:*, and optionally risk:* labels to a pull request, with size computed automatically from its diff.

  • github-pull-requests installed.
  • An open (or any existing) pull request in the target repository.
  • Write access sufficient to create labels and modify a PR’s labels.
  1. Pick a type from feat, fix, chore, docs, refactor, test, perf.

  2. Optionally pick a risk from low, medium, high. Omit it if you don’t want risk managed by this call.

  3. Call classify_pull_request:

    {
    "owner": "your-org",
    "repo": "your-repo",
    "pullNumber": 12,
    "type": "fix",
    "risk": "low"
    }
  4. Read the response: { type, size, risk, changedLines, changedFiles, labelsApplied, labelsRemoved }.

Check labelsApplied contains type:<your type>, size:<computed size>, and (if supplied) risk:<your risk>. Open the PR on GitHub and confirm the same labels are visible.

  • Size is computed from additions + deletions: XS (<10 lines), S (<30), M (<100), L (<500), XL (≥500) — the Danger.js / PR-size-labeler convention, not a plugin-specific scale.
  • Re-running this call with a different type or risk replaces the stale label of that category (reported in labelsRemoved); it does not accumulate multiple type:* labels on the same PR.
  • Omitting risk on a later call leaves any existing risk:* label untouched — it is not cleared just because you stopped supplying it.
  • Missing labels (type:fix, size:M, etc.) are created automatically on first use, with fixed colors per category.