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

Cherry pick dyladan/component-owners#14 #14

Merged
merged 3 commits into from
Apr 11, 2023
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ components:
- user3
- user4

# User assignment can be configured based on a file extension
"*.md":
- user5

# Optionally ignore some PR authors to reduce spam for assignees and reviewers
ignored-authors:
- dependabot
Expand Down
5 changes: 5 additions & 0 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ function match(name: string, ownedPath: string): boolean {
// Remove leading and trailing path separator
ownedPath = ownedPath.replace(/^\//, "").replace(/\/$/, "");

if (ownedPath.startsWith("*.")) {
const extension = ownedPath.substring(1)
return name.endsWith(extension)
}

const ownedPathParts = ownedPath.split(path.sep);
const filePathParts = name.split(path.sep).slice(0, ownedPathParts.length);

Expand Down