Skip to content

Commit f11462d

Browse files
committed
Making the PR statements case-insensitive
1 parent eae5d6d commit f11462d

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

src/AppBundle/Subscriber/AutoLabelPRFromContentSubscriber.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ public function onPullRequest(GitHubEvent $event)
4242
}
4343

4444
// the PR body usually indicates if this is a Bug, Feature, BC Break or Deprecation
45-
if (preg_match('/\|\s*Bug fix\?\s*\|\s*yes\s*/', $prBody, $matches)) {
45+
if (preg_match('/\|\s*Bug fix\?\s*\|\s*yes\s*/i', $prBody, $matches)) {
4646
$prLabels[] = 'Bug';
4747
}
48-
if (preg_match('/\|\s*New feature\?\s*\|\s*yes\s*/', $prBody, $matches)) {
48+
if (preg_match('/\|\s*New feature\?\s*\|\s*yes\s*/i', $prBody, $matches)) {
4949
$prLabels[] = 'Feature';
5050
}
51-
if (preg_match('/\|\s*BC breaks\?\s*\|\s*yes\s*/', $prBody, $matches)) {
51+
if (preg_match('/\|\s*BC breaks\?\s*\|\s*yes\s*/i', $prBody, $matches)) {
5252
$prLabels[] = 'BC Break';
5353
}
54-
if (preg_match('/\|\s*Deprecations\?\s*\|\s*yes\s*/', $prBody, $matches)) {
54+
if (preg_match('/\|\s*Deprecations\?\s*\|\s*yes\s*/i', $prBody, $matches)) {
5555
$prLabels[] = 'Deprecation';
5656
}
5757

src/AppBundle/Tests/Subscriber/AutoLabelPRFromContentSubscriberTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,27 @@ public function getPRTests()
121121
['Bug', 'Feature', 'BC Break', 'Deprecation'],
122122
];
123123

124+
$tests[] = [
125+
'case-insensitive!',
126+
<<<EOF
127+
Well hi cool peeps!
128+
129+
| Q | A
130+
| ------------- | ---
131+
| Branch? | master
132+
| Bug fix? | YeS
133+
| New feature? | yEs
134+
| BC breaks? | yES
135+
| Deprecations? | yeS
136+
| Tests pass? | yes
137+
| Fixed tickets | n/a
138+
| License | MIT
139+
| Doc PR | n/a
140+
EOF
141+
,
142+
['Bug', 'Feature', 'BC Break', 'Deprecation'],
143+
];
144+
124145
$tests[] = [
125146
'[Asset][BC Break][Fake] Extracting from title [Bug]',
126147
<<<EOF

0 commit comments

Comments
 (0)