Skip to content

Commit

Permalink
fix: make sure regex checking is at the start of the title, and that …
Browse files Browse the repository at this point in the history
…test catches it appropriately (#5314)

Also, make logging a little less confusing. Instead of saying:

```
{"severity":"INFO","level":30,"message":"Check otherOwlBotPRs for testRepoOwner/testRepoName/1 for no particular file is false"} // which means there are no otherowlbotPRs, so the check passes
{"severity":"INFO","level":30,"message":"Check otherCommitAuthors for testRepoOwner/testRepoName/1 for no particular file is false"} // which means there are no otherowlbotPRs, so the check passes
```

say:

```{"severity":"INFO","level":30,"message":"Check otherOwlBotPRs for testRepoOwner/testRepoName/1 for no particular file is true"} 
{"severity":"INFO","level":30,"message":"Check otherCommitAuthors for testRepoOwner/testRepoName/1 for no particular file is true"}```
  • Loading branch information
sofisl committed Apr 29, 2024
1 parent 974c423 commit 759896b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class OwlBotTemplateChangesNode extends OwlBotTemplateChanges {
// For this particular rule, we want to check a pattern and an antipattern;
// we want it to start with regular commit convention,
// and it should not be breaking or fix or feat
titleRegex: /$(chore|build|tests|refactor)/,
titleRegex: /^(chore|build|tests|refactor)/,
titleRegexExclude: /(fix|feat|breaking|!)/,
bodyRegex: /PiperOrigin-RevId/,
};
Expand Down Expand Up @@ -106,8 +106,8 @@ export class OwlBotTemplateChangesNode extends OwlBotTemplateChanges {
authorshipMatches,
titleMatches,
!bodyMatches,
otherOwlBotPRs,
otherCommitAuthors,
!otherOwlBotPRs,
!otherCommitAuthors,
],
incomingPR.repoOwner,
incomingPR.repoName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ describe('behavior of OwlBotTemplateChangesNode process', () => {

assert.deepStrictEqual(
await owlBotTemplateChanges.checkPR(incomingPR),
false
true
);
scopes.forEach(scope => scope.done());
});
Expand Down

0 comments on commit 759896b

Please sign in to comment.