Skip to content

Commit

Permalink
remove brackets
Browse files Browse the repository at this point in the history
Signed-off-by: Sylvain Niles <[email protected]>
  • Loading branch information
sylvainsf committed Jan 10, 2024
1 parent e70c8cc commit 2d0b306
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .github/actions/check-pr-format/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
- name: Check PR title
run: |
const title = context.payload.pull_request.title;
const regex = /\[(Add|Remove|Update|Fix)\]\s*.+/;
const regexNoBrackets = /(Add|Remove|Update|Fix)\s*.+/i;
const regex = /(Add|Remove|Update|Fix)\s*.+/;
const regexNoSpace = /\[(Add|Remove|Update|Fix)\].+/i;
const regexLowerCase = /\[(add|remove|update|fix)\]\s*.+/i;
const issue_number = context.payload.pull_request.number;
Expand All @@ -23,14 +22,12 @@ jobs:
let body = '';
if (!regex.test(title)) {
if (regexNoBrackets.test(title)) {
body = 'Your PR title is missing square brackets. Please update it to: [Add | Remove | Update | Fix] <Title>. For example: [Add] New feature';
} else if (regexNoSpace.test(title)) {
body = 'Your PR title is missing a space after the keyword. Please update it to: [Add | Remove | Update | Fix] <Title>. For example: [Remove] Old feature';
if (regexNoSpace.test(title)) {
body = 'Your PR title is missing a space after the keyword. Please update it to: [Add | Remove | Update | Fix] <Title>. For example: Remove Old feature';
} else if (regexLowerCase.test(title)) {
body = 'The keyword in your PR title is not capitalized. Please update it to: [Add | Remove | Update | Fix] <Title>. For example: [Update] Existing feature';
body = 'The keyword in your PR title is not capitalized. Please update it to: [Add | Remove | Update | Fix] <Title>. For example: Update Existing feature';
} else {
body = 'Your PR does not have a [Add | Remove | Update | Fix] <Title>. Please add one to help streamline our changelog. For example: [Fix] Bug in feature';
body = 'Your PR does not have a [Add | Remove | Update | Fix] <Title>. Please add one to help streamline our changelog. For example: Fix Bug in feature';
}
github.issues.createComment({ issue_number, owner, repo, body });
}
Expand Down

0 comments on commit 2d0b306

Please sign in to comment.