Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "Check PR Title"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]

jobs:
check-pr-title:
name: Check PR Title
runs-on: ubuntu-latest
steps:
- name: Enforce conventional commit style
uses: realm/ci-actions/title-checker@main
with:
regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*'
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'
ignore-labels: 'no-title-validation'
- name: Enforce JIRA ticket in title
uses: realm/ci-actions/title-checker@main
with:
regex: 'VSCODE-[0-9]{1,5}$'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It happens sometimes that we have tickets in one JIRA project that are touching multiple repos at the same time, should we extend this to allow all three (MONGOSH, COMPASS, VSCODE) or is the expectation now that we're supposed to open separate tickets when this happens?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I would vote for flexible behavior when no Jira tickets or multiple tickets are allowed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough. I've relaxed the regex to look for something that looks like a JIRA ticket - LMK if that makes sense to you. The exact values I've chosen are somewhat arbitrary - I chose them as {min(projectName.length) - 2, max(projectName.length) + 2}, but happy to tweak them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dependabot PRs won't have a Jira ticket chore(deps): bump the driver group with 2 updates. Changelog PRs as well chore: update CHANGELOG.md. Sometimes there are PRs with one line change, e.g. spelling mistakes. Those don't even require approval to be merged, so I don't think a ticket is worth creating in these cases. Could we enforce Jira tickets for feat and fix prefixes only?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforcing for particular prefix is not super easy, so I figured I'll just skip the Jira ticket check for bot PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about tiny PRs that do not have a corresponding ticket?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add the no-title-validation label (or just merge with the check failing).

error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. VSCODE-1234 or add the no-title-validation label'
ignore-labels: 'no-title-validation'
Loading