Skip to content

fix: 🚑 make it so is_in_bucket is consistent across same file key records #712

fix: 🚑 make it so is_in_bucket is consistent across same file key records

fix: 🚑 make it so is_in_bucket is consistent across same file key records #712

name: Enforce PR labels
on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-noteworthiness-label:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: yogevbd/[email protected]
with:
REQUIRED_LABELS_ANY: "B0-silent,B1-sdknoteworthy,B3-backendnoteworthy,B5-clientnoteworthy,B7-runtimenoteworthy"
REQUIRED_LABELS_ALL: ""
BANNED_LABELS: ""
- name: Verify breaking changes label
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')
uses: yogevbd/[email protected]
with:
REQUIRED_LABELS_ANY: "breaking,not-breaking"
REQUIRED_LABELS_ALL: ""
BANNED_LABELS: ""
enforce-auditability-label:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: yogevbd/[email protected]
with:
REQUIRED_LABELS_ANY: "D1-audited👍,D2-noauditneeded🙈,D3-trivial👶,D4-nicetohaveaudit⚠️,D5-needsaudit👮"
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: |
# 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 '## ⚠️ Breaking Changes ⚠️' heading."
echo "Extracting 'Breaking Changes' section for structural validation..."
BREAKING_SECTION="$(
printf '%s\n' "$PR_BODY" | awk '
BEGIN { flag=0 }
/^##[[:space:]]*⚠️[[:space:]]*Breaking[[:space:]]*Changes[[:space:]]*⚠️/ { flag=1; next }
/^##[[:space:]]+/ && flag==1 { flag=0 }
flag==1 { print }
'
)"
if [ -z "$BREAKING_SECTION" ]; then
echo "❌ Could not extract content under the '## ⚠️ Breaking Changes ⚠️' heading."
echo " Please ensure there is content under this heading describing the breaking change."
exit 1
fi
echo "Validating required structure inside 'Breaking Changes' section..."
# Require the three key bullets in the example template:
# - **Short description**
# - **Who is affected**
# - **Suggested code changes**
REQUIRED_ITEMS=("Short description" "Who is affected" "Suggested code changes")
for item in "${REQUIRED_ITEMS[@]}"; do
if ! printf '%s\n' "$BREAKING_SECTION" | grep -qiE "^[[:space:]]*-[[:space:]]+\*\*$item\*\*"; then
echo "❌ 'Breaking Changes' section must contain a bullet heading '**$item**'."
echo " Please follow the template:"
echo " - **Short description**"
echo " - **Who is affected**"
echo " - **Suggested code changes**"
exit 1
fi
done
echo "✅ 'Breaking Changes' section has the required structure."
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