Add CI job to verify all Rust files have license headers #1825
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Label Checker | |
| on: | |
| pull_request: | |
| branches: main | |
| types: [opened, labeled, unlabeled, synchronize, reopened] | |
| permissions: | |
| pull-requests: read | |
| contents: read | |
| jobs: | |
| check-labels: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Ensure exactly one "kind/*" label is applied | |
| run: | | |
| # Count the number of "kind/*" labels using GitHub API via github.event | |
| LABELS=$(echo '${{ toJSON(github.event.pull_request.labels) }}' | jq -r '.[].name') | |
| KIND_LABEL_COUNT=$(echo "$LABELS" | grep -c "^kind/" || true) | |
| if [[ "$KIND_LABEL_COUNT" -eq 1 ]]; then | |
| echo "✅ Exactly one 'kind/*' label is applied." | |
| exit 0 | |
| else | |
| echo "❌ PR must have exactly one 'kind/*' label, but found $KIND_LABEL_COUNT." | |
| exit 1 | |
| fi |