Skip to content

Commit

Permalink
fix: matching
Browse files Browse the repository at this point in the history
  • Loading branch information
anc95 committed Dec 11, 2024
1 parent b7d3be9 commit 75c8d14
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion action/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -150537,7 +150537,7 @@ exports.robot = robot;
const matchPatterns = (patterns, path) => {
return patterns.some((pattern) => {
try {
return (0, minimatch_1.minimatch)(path, pattern);
return (0, minimatch_1.minimatch)(path, pattern.startsWith('/') || pattern.startsWith('**') ? pattern : `**/${pattern}`);
}
catch {
// if the pattern is not a valid glob pattern, try to match it as a regular expression
Expand Down
2 changes: 1 addition & 1 deletion src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const robot = (app: Probot) => {
const matchPatterns = (patterns: string[], path: string) => {
return patterns.some((pattern) => {
try {
return minimatch(path, pattern)
return minimatch(path, pattern.startsWith('/') || pattern.startsWith('**') ? pattern : `**/${pattern}`);
} catch {
// if the pattern is not a valid glob pattern, try to match it as a regular expression
try {
Expand Down

0 comments on commit 75c8d14

Please sign in to comment.