aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/check-mergable-by-label.yml
blob: 2e36582e26a56960b3d9b609459c308567675583 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: PR Labels

on:
  pull_request:
    types:
      - opened
      - reopened
      - synchronize
      - edited
      - labeled
      - unlabeled
  merge_group:

permissions: {}

jobs:
  fail-by-blocking-label:
    runs-on: ubuntu-latest
    if: ${{ github.event_name != 'merge_group' }}
    steps:
      - name: Check for blocking labels
        run: |
          BLOCKING_LABELS=("do NOT merge yet" "s: on hold")
          PR_LABELS=$(jq -r '.pull_request.labels[].name' "$GITHUB_EVENT_PATH")

          for LABEL in "${BLOCKING_LABELS[@]}"; do
            if [[ "$PR_LABELS" == *"$LABEL"* ]]; then
              echo "This PR has a blocking label: $LABEL"
              exit 1
            fi
          done

          echo "No blocking labels found"