Skip to content

Commit e3afe24

Browse files
update trigger check to be less greedy when matching
1 parent 48285b1 commit e3afe24

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/functions/trigger-check.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ export async function triggerCheck(body, trigger) {
1414
return false
1515
}
1616

17+
// Ensure the trigger match is complete: either end-of-string or followed by whitespace
18+
const nextChar = body.slice(trigger.length, trigger.length + 1)
19+
if (nextChar && !/\s/.test(nextChar)) {
20+
core.debug(
21+
`comment body starts with trigger but is not complete: ${COLORS.highlight}${trigger}${COLORS.reset}`
22+
)
23+
return false
24+
}
25+
1726
core.info(
1827
`✅ comment body starts with trigger: ${COLORS.highlight}${trigger}${COLORS.reset}`
1928
)

0 commit comments

Comments
 (0)