This action allows you to fail the build if/unless a certain combination of labels are applied to a pull request.
This action has three inputs:
This is a list of comma separated labels to match on.
labels: 'label-one, another:label, bananas'
One of: exactly
, minimum
, maximum
The number of labels to apply mode
to
name: Pull Request Labels
on:
pull_request:
types: [opened, labeled, unlabeled, synchronize]
jobs:
label:
runs-on: ubuntu-latest
steps:
- uses: mheap/github-action-required-labels@v1
with:
mode: exactly
count: 1
labels: "semver:patch, semver:minor, semver:major"
By default this actions reads event.json
, which will not detect when a label is added in an earlier step.
To force an API call, set the GITHUB_TOKEN
environment variable like so:
- uses: mheap/github-action-required-labels@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
mode: exactly
count: 1
labels: "semver:patch, semver:minor, semver:major"
- uses: mheap/github-action-required-labels@v1
with:
mode: exactly
count: 0
labels: "do not merge"
- uses: mheap/github-action-required-labels@v1
with:
mode: minimum
count: 2
labels: "community-reviewed, team-reviewed, codeowner-reviewed"