Skip to content

Commit c8d82fd

Browse files
authored
chore(ci): Add a workflow to validate PR titles (#2240)
* Add a workflow to validate PR titles * Change the example jira ticket
1 parent 06916e5 commit c8d82fd

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: "Check PR Title"
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]
5+
6+
jobs:
7+
check-pr-title:
8+
name: Check PR Title
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Enforce conventional commit style
12+
uses: realm/ci-actions/title-checker@main
13+
with:
14+
regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*'
15+
error-hint: 'Invalid PR title. Make sure it follows the conventional commit specification (i.e. "<type>(<optional scope>): <description>") or add the no-title-validation label'
16+
ignore-labels: 'no-title-validation'
17+
- name: Enforce JIRA ticket in title
18+
uses: realm/ci-actions/title-checker@main
19+
# Skip the JIRA ticket check for PRs opened by bots
20+
if: ${{ !contains(github.event.pull_request.user.login, '[bot]') }}
21+
with:
22+
regex: '[A-Z]{4,10}-[0-9]{1,5}$'
23+
error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. MONGOSH-1234 or add the no-title-validation label'
24+
ignore-labels: 'no-title-validation'

0 commit comments

Comments
 (0)