Skip to content

Dev/sync services

Dev/sync services #5

Workflow file for this run

name: Enforce PR Labels
on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize, closed]
jobs:
check-label:
name: Ensure PR has a valid version label
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v3
# Validate PR labels using jq
- name: Validate PR labels
run: |
# Extract labels using jq
labels=$(echo '${{ toJson(github.event.pull_request.labels) }}' | jq -r '.[].name')
# Check if no labels were found
if [ -z "$labels" ]; then
echo "Error: No labels found on this pull request."
exit 1
fi
# Check if any label matches major, minor, or patch
if echo "$labels" | grep -Eq "^(major|minor|patch)$"; then
echo "Valid label found: $labels"
else
echo "Error: PR must have one of the following labels: major, minor, or patch."
exit 1
fi