Skip to content

Commit 54fc47a

Browse files
Copilotsimongdavies
andcommitted
Revert changes to PRLabelChecker.yml
Co-authored-by: simongdavies <[email protected]>
1 parent 7f715d9 commit 54fc47a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

.github/workflows/PRLabelChecker.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
- uses: actions/checkout@v4
1515
- name: Ensure exactly one "kind/*" label is applied
1616
run: |
17-
# Count the number of "kind/*" labels using GitHub API via github.event
18-
LABELS=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[].name')
19-
KIND_LABEL_COUNT=$(echo "$LABELS" | grep -c "^kind/" || true)
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/')
2020
2121
if [[ "$KIND_LABEL_COUNT" -eq 1 ]]; then
2222
echo "✅ Exactly one 'kind/*' label is applied."
@@ -25,3 +25,5 @@ jobs:
2525
echo "❌ PR must have exactly one 'kind/*' label, but found $KIND_LABEL_COUNT."
2626
exit 1
2727
fi
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)