danger-plugin-labels
Let any contributor add labels to their pull requests and issues
Usage
Install:
yarn add danger-plugin-labels --dev
At a glance:
// dangerfile.js
<!-- PULL_REQUEST_TEMPLATE.md --> **Status (check one)** - [ ] WIP- [ ] Ready for Review
Now contributors even without write access to the repo can label their PR as "Work In Progress" and "Ready for Review"!
Note: There is experimental issue support if you're using Peril and point the
issue
event hook to your Dangerfile. No guarantees it won't break though!
Options
rules
(required)
Rules lets you specify which labels to apply depending on which checkboxes are ticked:
Because it's tedious to repeat the same string twice if the label matches the checkbox, you can also provide the shorthand notation:
Note: The checkbox text in this case is case insensitive (
wip
,Wip
andWIP
in the markdown would all apply the label), but the label content isn't. (GitHub treats "WIP" as a separate label than "wip", make sure to match the text exactly!)
validate
A function that's called with all the matching labels, allowing you to accept or reject them by returnng true
or false
, respectively. This is useful for a number of things, for example to limit the maximum number of labels selected:
;
This method can also be asynchronous so you can do all sorts of cool stuff, like close issues that users want to label as questions:
;
Changelog
See the GitHub release history.
Contributing
See CONTRIBUTING.md.