🏷️ GitHub Action for running a label validation on Pull Requests
APACHE-2.0 License
This GitHub Action is created to validate pull requests based on predefined labels.
By specifying valid and/or invalid labels, this action ensures that pull requests are labeled consistently according to your project standards. If a pull request does not contain at least one valid label or if it contains any invalid labels, the action will fail and providing clear error messages.
The following input parameters can be used to configure the action:
repo-token
The GitHub token used to interact with the GitHub API.
${{ github.token }}
pr-number
The number of the pull request to validate.
${{ github.event.pull_request.number }}
valid-labels
A comma-separated list of valid labels that are allowed on the pull request.
invalid-labels
A comma-separated list of invalid labels that are not allowed on the pull request.
None. This action does not set any outputs.
This example workflows demonstrates a minimal configuration to validate pull requests based on predefined labels. In this example, the action is configured to check for valid labels breaking-change
, bugfix
, documentation
, and enhancement
.
name: PR Labels
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]
jobs:
validate:
name: Verify
runs-on: ubuntu-latest
steps:
- name: 🏷 Verify PR has a valid label
uses: klaasnicolaas/action-pr-labels@v1
with:
valid-labels: >-
breaking-change, bugfix, documentation, enhancement
This example workflow demonstrates a full example configuration to validate pull requests based on predefined labels. In this example, the action is configured to check for valid labels breaking-change
, bugfix
, documentation
, and enhancement
. Additionally, it checks for invalid labels duplicate
and invalid
.
name: PR Labels
on:
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]
jobs:
validate:
name: Verify
runs-on: ubuntu-latest
steps:
- name: 🏷 Verify PR has a valid label
uses: klaasnicolaas/action-pr-labels@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-number: ${{ github.event.pull_request.number }}
valid-labels: >-
breaking-change, bugfix, documentation, enhancement
invalid-labels: >-
duplicate, invalid
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We've set up a separate document for our contribution guidelines.
Thank you for being involved! 😍
Distributed under the Apache License 2.0 license. See LICENSE
for more information.