From 67113c740c7fe8d2482823e8b46530623d585b72 Mon Sep 17 00:00:00 2001 From: Alan Sapede Date: Thu, 5 Dec 2024 08:22:24 +0100 Subject: [PATCH] Adds a GHA check for breaking change description (#3074) * Adds a GHA check for breaking change description * prettier --- .github/workflows/enforce-pr-labels.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/enforce-pr-labels.yml b/.github/workflows/enforce-pr-labels.yml index d08c7e4517..3ac91cbcf7 100644 --- a/.github/workflows/enforce-pr-labels.yml +++ b/.github/workflows/enforce-pr-labels.yml @@ -31,3 +31,26 @@ jobs: REQUIRED_LABELS_ANY: "D1-audited👍,D5-nicetohaveaudit⚠️,D9-needsaudit👮,D2-notlive,D3-trivial" REQUIRED_LABELS_ALL: "" BANNED_LABELS: "" + validate-breaking-description: + runs-on: ubuntu-latest + steps: + - name: Validate PR for "breaking" label and description + env: + PR_BODY: ${{ github.event.pull_request.body }} + PR_LABELS: ${{ toJson(github.event.pull_request.labels) }} + run: | + echo "Pull Request Labels: $PR_LABELS" + echo "Pull Request Body: $PR_BODY" + + # Check if "breaking" label is set + if echo "$PR_LABELS" | grep -q '"breaking"'; then + echo "Label 'breaking' is present. Checking description..." + if echo "$PR_BODY" | grep -qi "## ⚠️ Breaking Changes ⚠️"; then + echo "✅ Description contains the required phrase." + else + echo "❌ Description does not contain the required phrase '## ⚠️ Breaking Changes ⚠️'." + exit 1 + fi + else + echo "Label 'breaking' is not present. No validation needed." + fi