-
Notifications
You must be signed in to change notification settings - Fork 90
build: Add github action for PR title validation VSCODE-642 #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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}$' | ||
| 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' | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 wellchore: 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 forfeatandfixprefixes only?There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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-validationlabel (or just merge with the check failing).