|
| 1 | +Check Labels Action |
| 2 | +=================== |
| 3 | + |
| 4 | +This action checks the labels of a Pull Request and will succeed or fail based |
| 5 | +on the configuration. |
| 6 | + |
| 7 | +Inputs |
| 8 | +------ |
| 9 | + |
| 10 | +### `access_token` |
| 11 | +An optional [personal access token], required for private repositories and to |
| 12 | +decrease rate limiting. |
| 13 | + |
| 14 | +[personal access token]: https://github.com/settings/tokens |
| 15 | + |
| 16 | +### `set_labels` |
| 17 | +Comma-separated list of labels required to be set. Optional. Globing syntax is |
| 18 | +possible for the label name, as defined in [fnmatch]. |
| 19 | + |
| 20 | +### `unset_labels` |
| 21 | +Comma-separated list of labels required not to be set. Optional. Globing syntax |
| 22 | +is possible for the label name, as defined in [fnmatch]. |
| 23 | + |
| 24 | +### `cond_labels` |
| 25 | +Comma-separated list of (label,condition) tuples for labels introducing a |
| 26 | +condition. Optional. Globing syntax is possible for the label name, as defined |
| 27 | +in [fnmatch]. |
| 28 | + |
| 29 | +#### Supported conditions |
| 30 | +- `review.approvals>x`: If the label is set in the Pull Request it requires more |
| 31 | + than `x` approving reviews for the action to succeed |
| 32 | + |
| 33 | +[fnmatch]: https://docs.python.org/3/library/fnmatch.html |
| 34 | + |
| 35 | +# Examples |
| 36 | + |
| 37 | +We recommend the following workflow triggers: |
| 38 | + |
| 39 | +```yml |
| 40 | +on: |
| 41 | + pull_request: |
| 42 | + types: [opened, reopened, labeled, unlabeled] |
| 43 | + pull_request_review: |
| 44 | + types: [submitted, dismissed] |
| 45 | +``` |
| 46 | +
|
| 47 | +The action will fail if "REQUIRE" and "MANDATORY" are not set, if any label |
| 48 | +starting with "INVALID" is set, or if "NEEDS >1 ACK" is set, but the PR only has |
| 49 | +one or no approval: |
| 50 | +
|
| 51 | +```yml |
| 52 | + |
| 53 | +with: |
| 54 | + access_token: '${{ secrets.GITHUB_ACCESS_TOKEN }}' |
| 55 | + set_labels: 'REQUIRE, MANDATORY' |
| 56 | + unset_labels: 'INVALID*' |
| 57 | + cond_labels: '(NEEDS >1 ACK,review.approvals > 1)' |
| 58 | +``` |
0 commit comments