A Github action to enforce labeling a pull request with specified labels.
- required_labels: A list of labels that at least one is required on the pull request.
Currently there are no outputs defined for this workflow.
This action does not use any secrets.
Learn more about GitHub Actions in general here.
To use this action in your repo, follow these steps:
- Create a YAML file in the
.github/workflows/
directory of your repo. - Copy the following into the YAML file:
---
name: Enforce Labeling
on:
pull_request_target:
types: [opened, synchronize, reopened, labeled, unlabeled]
branches:
- main
workflow_dispatch:
jobs:
check_labels:
runs-on: ubuntu-latest
steps:
- name: Check Pull Request Labels
uses: discoverygarden/enforce-label@main
with:
required_labels: major,minor,patch,no-update
The labels provided in this case are our typical semantic version tagging labels, as well as a no-update
label that will not initiate the semantic tagging workflow, in the rare case we don't want to initiate the workoflow.
The types
on the pull_request_target
are the base conditions [opened, synchronize, reopened]
as well as two scenarios [labeled, unlabeled]
which we want to track as we're specifically dealing with labels.