Skip to content

optimaxdev/check-qa-label

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Check QA Label Action

A GitHub Action that validates pull requests have at least one of the required QA-related labels before they can be merged.

Features

  • ✅ Validates that PRs have required labels
  • 🔧 Configurable label requirements
  • 📊 Clear error messages when validation fails
  • 🔄 Runs automatically on PR events (labeled, unlabeled, opened, synchronize)

Usage

Basic Usage

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@v1

This will validate that the PR has either test-passed or no QA label.

Custom Labels

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"

Using the Output

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 }}"

Inputs

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 }}

Outputs

Output Description
matched-label The label that matched from the required labels list

How It Works

  1. The action runs on pull request events (when labels change or PR is updated)
  2. It fetches all current labels on the PR using the GitHub API
  3. It checks if at least one of the required labels is present
  4. If a required label is found, the workflow passes ✅
  5. If no required labels are found, the workflow fails ❌ with a clear error message

Example Scenarios

Scenario 1: QA Testing Required

Require that QA has tested the changes:

with:
  required-labels: "test-passed"

Scenario 2: QA or Skip Option

Allow either QA testing or explicit skip:

with:
  required-labels: "test-passed,no QA"

Scenario 3: Multiple QA States

Support multiple QA validation states:

with:
  required-labels: "qa-approved,qa-not-required,manual-testing-done"

Development

This action is implemented as a composite action using shell scripts, making it lightweight and fast with no dependencies to install.

License

MIT

About

An action to check QA labels and prevent merging if a required one is missing.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors