Analysis #44
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
| # Verifies if a pull request has at least one label from a set of valid | |
| # labels before it can be merged. | |
| name: PR label checks | |
| on: | |
| pull_request_target: | |
| types: [opened, labeled, unlabeled, synchronize] | |
| permissions: | |
| pull-requests: read | |
| jobs: | |
| require-label: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate required labels | |
| run: | | |
| PR_LABELS=$(echo '${{ toJson(github.event.pull_request.labels.*.name) }}' | jq -r '.[]') | |
| echo "Current PR labels: $PR_LABELS" | |
| VALID_LABELS=( | |
| "[bot] pull request" | |
| "[scope] bug" | |
| "[scope] documentation" | |
| "[scope] enhancement" | |
| "[scope] maintenance" | |
| "[scope] significant" | |
| ) | |
| found=false | |
| for label in "${VALID_LABELS[@]}"; do | |
| if echo "$PR_LABELS" | grep -Fxq "$label"; then | |
| echo "✅ Found valid label: $label" | |
| found=true | |
| break | |
| fi | |
| done | |
| if [ "$found" = false ]; then | |
| echo "ERROR: PR must have at least one of the following labels:" | |
| for label in "${VALID_LABELS[@]}"; do | |
| echo " - $label" | |
| done | |
| exit 1 | |
| fi |