A GitHub Action that validates pull requests have at least one of the required QA-related labels before they can be merged.
- ✅ Validates that PRs have required labels
- 🔧 Configurable label requirements
- 📊 Clear error messages when validation fails
- 🔄 Runs automatically on PR events (labeled, unlabeled, opened, synchronize)
Add this to your workflow file (e.g., .github/workflows/check-qa-label.yml):
name: Check QA Label
on:
pull_request:
types:
- labeled
- unlabeled
- opened
- synchronize
jobs:
validate-labels:
runs-on: ubuntu-latest
steps:
- name: Check QA Label
uses: optimaxdev/check-qa-label@v1This will validate that the PR has either test-passed or no QA label.
You can specify your own required labels:
name: Check QA Label
on:
pull_request:
types:
- labeled
- unlabeled
- opened
- synchronize
jobs:
validate-labels:
runs-on: ubuntu-latest
steps:
- name: Check QA Label
uses: optimaxdev/check-qa-label@v1
with:
required-labels: "test-passed,no QA,qa-approved"The action outputs which label matched:
jobs:
validate-labels:
runs-on: ubuntu-latest
steps:
- name: Check QA Label
id: check-label
uses: optimaxdev/check-qa-label@v1
- name: Use the matched label
run: |
echo "Matched label: ${{ steps.check-label.outputs.matched-label }}"| Input | Description | Required | Default |
|---|---|---|---|
required-labels |
Comma-separated list of required labels (at least one must be present) | No | test-passed,no QA |
github-token |
GitHub token for authentication | No | ${{ github.token }} |
| Output | Description |
|---|---|
matched-label |
The label that matched from the required labels list |
- The action runs on pull request events (when labels change or PR is updated)
- It fetches all current labels on the PR using the GitHub API
- It checks if at least one of the required labels is present
- If a required label is found, the workflow passes ✅
- If no required labels are found, the workflow fails ❌ with a clear error message
Require that QA has tested the changes:
with:
required-labels: "test-passed"Allow either QA testing or explicit skip:
with:
required-labels: "test-passed,no QA"Support multiple QA validation states:
with:
required-labels: "qa-approved,qa-not-required,manual-testing-done"This action is implemented as a composite action using shell scripts, making it lightweight and fast with no dependencies to install.
MIT