Discover Packages
github.com/agilepathway/label-checker
module
Version:
v1.0.111
Opens a new window with list of versions in this module.
Published: Jul 18, 2022
License: MIT
Opens a new window with license information.
README
README
¶
Label Checker
GitHub Action to check pull requests (PRs) for the presence or absence of specified labels
Why another label checker?
We couldn't find another label checker that had all our 4 check types (one_of
, none_of
, all_of
, any_of
)
Speed : the Docker image
used for the checks is only 2.7 MB, so the checks are blazingly fast (c. 3 seconds)
Using the Label Checker action
Using this action is as simple as:
create a .github\workflows
directory in your repository
create a
YAML
file in the .github\workflows
directory (file name can be anything you like,
with either a .yml
or .yaml
file extension), with this example content:
---
name: Label Checker
on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled
jobs:
check_labels:
name: Check labels
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: major,minor,patch
repo_token: ${{ secrets.GITHUB_TOKEN }}
customise the label checks in the with
section of the YAML file to fit your needs
(see the checks section below for the different checks you can configure)
Checks
There are 4 types of label checks available:
one_of
(PRs must have exactly one of these labels)
none_of
(PRs must have none of these labels)
all_of
(PRs must have all of these labels)
any_of
(PRs must have one or more of these labels)
You can have as many of the checks configured in the same YAML file as you like.
Examples
Semantic versioning : one_of: major,minor,patch
Each PR must be a bug or an enhancement: one_of: bug,enhancement
Prohibit certain labels: none_of: invalid,wontfix,duplicate,question
Require each PR to have a certain label: all_of: enhancement
or labels: all_of: enhancement,reviewed
Require each PR to have one or more of these labels: any_of: documentation,enhancement,bug
Combine multiple checks:
with:
one_of: major,minor,patch
none_of: invalid,wontfix,duplicate,question
any_of: documentation,enhancement,bug
repo_token: ${{ secrets.GITHUB_TOKEN }}
Combine multiple checks of the same type:
jobs:
check_semver_label:
name: Check for semantic version label
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: major,minor,patch
repo_token: ${{ secrets.GITHUB_TOKEN }}
check_pull_request_type:
name: Check for pull request type label
runs-on: ubuntu-latest
steps:
- uses: docker://agilepathway/pull-request-label-checker:latest
with:
one_of: bug,enhancement
repo_token: ${{ secrets.GITHUB_TOKEN }}
Suggestions / bug reports / contributions
The project is open source and all contributions are very welcome 🙂 💥 👍
Updating dependencies
See the DEPENDENCIES.md
Expand ▾
Collapse ▴
Directories
¶
internal
error/panic
Package panic provides utility panic functions
Package panic provides utility panic functions
github
Package github encapsulates GitHub Action data and behaviour
Package github encapsulates GitHub Action data and behaviour
Package pullrequest checks pull requests for specified labels
slice
Package slice provides utility functions for slices
Package slice provides utility functions for slices
Click to show internal directories.
Click to hide internal directories.