Compare commits
1 commit
main
...
trstringer
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d2f2a6220 |
2 changed files with 6 additions and 1 deletions
|
|
@ -147,7 +147,7 @@ func isApproved(commentBody string) (bool, error) {
|
||||||
|
|
||||||
func isDenied(commentBody string) (bool, error) {
|
func isDenied(commentBody string) (bool, error) {
|
||||||
for _, deniedWord := range deniedWords {
|
for _, deniedWord := range deniedWords {
|
||||||
matched, err := regexp.MatchString(fmt.Sprintf("(?i)^%s[.!]?$", deniedWord), commentBody)
|
matched, err := regexp.MatchString(fmt.Sprintf("(?i)^%s[.!]*\n*$", deniedWord), commentBody)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -316,6 +316,11 @@ func TestDeniedCommentBody(t *testing.T) {
|
||||||
commentBody: "this is just some random comment",
|
commentBody: "this is just some random comment",
|
||||||
isSuccess: false,
|
isSuccess: false,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "denied_with_newline",
|
||||||
|
commentBody: "denied\n",
|
||||||
|
isSuccess: true,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, testCase := range testCases {
|
for _, testCase := range testCases {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue