|
| 1 | +name: Enforce PR labels |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [labeled, unlabeled, opened, edited, synchronize] |
| 6 | +jobs: |
| 7 | + enforce-noteworthiness-label: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + permissions: |
| 10 | + contents: read |
| 11 | + steps: |
| 12 | + |
| 13 | + with: |
| 14 | + REQUIRED_LABELS_ANY: "B0-silent,B1-sdknoteworthy,B3-backendnoteworthy,B5-clientnoteworthy,B7-runtimenoteworthy" |
| 15 | + REQUIRED_LABELS_ALL: "" |
| 16 | + BANNED_LABELS: "" |
| 17 | + - name: Verify breaking changes label |
| 18 | + if: contains(github.event.pull_request.labels.*.name, 'B1-sdknoteworthy') || contains(github.event.pull_request.labels.*.name, 'B3-backendnoteworthy') || contains(github.event.pull_request.labels.*.name, 'B5-clientnoteworthy') || contains(github.event.pull_request.labels.*.name, 'B7-runtimenoteworthy') |
| 19 | + |
| 20 | + with: |
| 21 | + REQUIRED_LABELS_ANY: "breaking,not-breaking" |
| 22 | + REQUIRED_LABELS_ALL: "" |
| 23 | + BANNED_LABELS: "" |
| 24 | + enforce-auditability-label: |
| 25 | + runs-on: ubuntu-latest |
| 26 | + permissions: |
| 27 | + contents: read |
| 28 | + steps: |
| 29 | + |
| 30 | + with: |
| 31 | + REQUIRED_LABELS_ANY: "D1-audited👍,D2-noauditneeded🙈,D3-trivial👶,D4-nicetohaveaudit⚠️,D5-needsaudit👮" |
| 32 | + REQUIRED_LABELS_ALL: "" |
| 33 | + BANNED_LABELS: "" |
| 34 | + validate-breaking-description: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + steps: |
| 37 | + - name: Validate PR for "breaking" label and description |
| 38 | + env: |
| 39 | + PR_BODY: ${{ github.event.pull_request.body }} |
| 40 | + PR_LABELS: ${{ toJson(github.event.pull_request.labels) }} |
| 41 | + run: | |
| 42 | + echo "Pull Request Labels: $PR_LABELS" |
| 43 | + echo "Pull Request Body: $PR_BODY" |
| 44 | +
|
| 45 | + # Check if "breaking" label is set |
| 46 | + if echo "$PR_LABELS" | grep -q '"breaking"'; then |
| 47 | + echo "Label 'breaking' is present. Checking description..." |
| 48 | + if echo "$PR_BODY" | grep -qi "## ⚠️ Breaking Changes ⚠️"; then |
| 49 | + echo "✅ Description contains the required phrase." |
| 50 | + else |
| 51 | + echo "❌ Description does not contain the required phrase '## ⚠️ Breaking Changes ⚠️'." |
| 52 | + exit 1 |
| 53 | + fi |
| 54 | + else |
| 55 | + echo "Label 'breaking' is not present. No validation needed." |
| 56 | + fi |
0 commit comments