Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: glob matching #171

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ jobs:
LANGUAGE: English
OPENAI_API_ENDPOINT: https://api.bianxie.ai/v1
LOG_LEVEL: debug
INCLUDE_PATTERNS: 'src/**/*'
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 : pattern.startsWith("**") ? pattern : "**/" + pattern);
}
catch {
// if the pattern is not a valid glob pattern, try to match it as a regular expression
anc95 marked this conversation as resolved.
Show resolved Hide resolved
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 : pattern.startsWith("**") ? pattern : "**/" + pattern);
} catch {
// if the pattern is not a valid glob pattern, try to match it as a regular expression
try {
anc95 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Loading