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.
Prerequisites
Section titled “Prerequisites”github-pull-requestsinstalled.- An open (or any existing) pull request in the target repository.
- Write access sufficient to create labels and modify a PR’s labels.
-
Pick a
typefromfeat,fix,chore,docs,refactor,test,perf. -
Optionally pick a
riskfromlow,medium,high. Omit it if you don’t want risk managed by this call. -
Call
classify_pull_request:{"owner": "your-org","repo": "your-repo","pullNumber": 12,"type": "fix","risk": "low"} -
Read the response:
{ type, size, risk, changedLines, changedFiles, labelsApplied, labelsRemoved }.
Verify it worked
Section titled “Verify it worked”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
typeorriskreplaces the stale label of that category (reported inlabelsRemoved); it does not accumulate multipletype:*labels on the same PR. - Omitting
riskon a later call leaves any existingrisk:*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.