Skip to content

Commit 740b0f0

Browse files
committed
Replace hardcoded label list with kind/* label convention
Aligns the PR label checker with the convention used across other Hyperlight projects, which require exactly one kind/* prefixed label instead of matching against a brittle hardcoded list. This ensures consistency across the organization and removes the need to manually update allowed labels when new categories are added. Fixes #4 Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
1 parent 4ea4776 commit 740b0f0

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

.github/workflows/PRLabelChecker.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- uses: actions/checkout@v6
15-
- name: Check for specific labels
15+
- name: Ensure exactly one "kind/*" label is applied
1616
run: |
17-
PR_NUMBER=$(echo ${{ github.event.pull_request.number }})
18-
LABELS_JSON=$(gh pr view $PR_NUMBER --json labels -q '.labels.[] | .name')
19-
REQUIRED_LABELS=("chore" "ignore" "breaking-change" "enhancement" "feature" "dependencies" "bug" "security" "performance" "refactor" "testing" "documentation" "github-actions")
20-
for REQUIRED_LABEL in "${REQUIRED_LABELS[@]}"; do
21-
if echo "$LABELS_JSON" | grep -q "$REQUIRED_LABEL"; then
22-
echo "One of the required labels is present"
23-
exit 0
24-
fi
25-
done
26-
echo "None of the required labels are present"
27-
exit 1
17+
# Count the number of "kind/*" labels directly from the PR labels
18+
PR_NUMBER=${{ github.event.pull_request.number }}
19+
KIND_LABEL_COUNT=$(gh pr view "$PR_NUMBER" --json labels -q '.labels.[].name' | grep -c '^kind/')
20+
21+
if [[ "$KIND_LABEL_COUNT" -eq 1 ]]; then
22+
echo "✅ Exactly one 'kind/*' label is applied."
23+
exit 0
24+
else
25+
echo "❌ PR must have exactly one 'kind/*' label, but found $KIND_LABEL_COUNT."
26+
exit 1
27+
fi
2828
env:
2929
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)