File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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."
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 }}
You can’t perform that action at this time.
0 commit comments