@@ -3,14 +3,29 @@ name: CRD Validation
33on :
44 pull_request :
55 types : [opened, edited, synchronize, reopened, labeled, unlabeled]
6+ issue_comment :
7+ types : [created]
68
79permissions :
810 contents : read
911 pull-requests : write
1012
1113jobs :
14+ ack-breaking-changes :
15+ name : Ack Breaking Changes Labeler
16+ if : github.event.issue.pull_request && startsWith(github.event.comment.body, '/ack-breaking-changes')
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Add Label
20+ env :
21+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
22+ run : |
23+ gh pr edit ${{ github.event.issue.number }} --add-label "ack-breaking-changes"
24+ echo "✅ Added 'ack-breaking-changes' label based on comment."
25+
1226 crd-validation :
1327 name : CRD Validation Check
28+ if : github.event_name == 'pull_request'
1429 runs-on : ubuntu-latest
1530 steps :
1631 - name : Checkout code
@@ -30,16 +45,16 @@ jobs:
3045 go install sigs.k8s.io/crdify@latest
3146
3247 - name : Reset Validation Approval
33- if : github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, '/ ack-breaking-changes')
48+ if : github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'ack-breaking-changes')
3449 env :
3550 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3651 run : |
37- gh pr edit ${{ github.event.pull_request.number }} --remove-label "/ ack-breaking-changes"
38- echo "⚠️ Removed '/ ack-breaking-changes' label due to new changes. Re-approval required."
52+ gh pr edit ${{ github.event.pull_request.number }} --remove-label "ack-breaking-changes"
53+ echo "⚠️ Removed 'ack-breaking-changes' label due to new changes. Re-approval required."
3954
4055 - name : Run CRD Validation Check
4156 env :
42- ALLOW_BREAKING : ${{ contains(github.event.pull_request.labels.*.name, '/ ack-breaking-changes') && github.event.action != 'synchronize' }}
57+ ALLOW_BREAKING : ${{ contains(github.event.pull_request.labels.*.name, 'ack-breaking-changes') && github.event.action != 'synchronize' }}
4358 run : |
4459 git fetch origin ${{ github.base_ref }}:upstream_base
4560 BASE_SHA=$(git rev-parse upstream_base)
6075 exit 0
6176 else
6277 echo "❌ error: Validation failed! Found $FAILED incompatible CRD change(s)."
63- echo "⚠️ notice: To allow these changes, a reviewer must add the '/ ack-breaking-changes' label to the PR."
78+ echo "⚠️ notice: To allow these changes, a reviewer must add the 'ack-breaking-changes' label to the PR or comment '/ack-breaking-changes' ."
6479 exit 1
6580 fi
6681 fi
6782
68- echo "All CRDs are compatible."
83+ echo "All CRDs are compatible."
0 commit comments