Skip to content

Fix last_files_match_only to evaluate per file instead of globally#135

Merged
necojackarc merged 1 commit intonecojackarc:masterfrom
k0kubun:fix-last-files-match-only
Apr 2, 2026
Merged

Fix last_files_match_only to evaluate per file instead of globally#135
necojackarc merged 1 commit intonecojackarc:masterfrom
k0kubun:fix-last-files-match-only

Conversation

@k0kubun
Copy link
Copy Markdown
Contributor

@k0kubun k0kubun commented Mar 31, 2026

Follow-up on #80

Previously, when last_files_match_only was enabled, every time a pattern matched any changed file, all previously accumulated reviewers were cleared. This meant the last pattern that matched ANY file in the PR determined all reviewers, which was wrong (different from CODEOWNERS) when different files had different last-matching patterns.

Now, for each changed file independently, we find its last matching pattern's reviewers, then union the results across all files. This correctly handles the case where e.g. a generated file overrides reviewers to [] while a non-generated file in the same directory still matches the wildcard pattern's reviewers.

Previously, when last_files_match_only was enabled, every time a pattern
matched any changed file, all previously accumulated reviewers were
cleared. This meant the last pattern that matched ANY file in the PR
determined all reviewers, which was wrong when different files had
different last-matching patterns.

Now, for each changed file independently, we find its last matching
pattern's reviewers, then union the results across all files. This
correctly handles the case where e.g. a generated file overrides
reviewers to [] while a non-generated file in the same directory still
matches the wildcard pattern's reviewers.
@k0kubun k0kubun force-pushed the fix-last-files-match-only branch from cea5720 to 0df295a Compare March 31, 2026 22:51
@k0kubun k0kubun marked this pull request as ready for review March 31, 2026 22:52
@k0kubun k0kubun requested a review from necojackarc as a code owner March 31, 2026 22:52
k0kubun added a commit to ruby/ruby that referenced this pull request Mar 31, 2026
necojackarc/auto-request-review#135 fixes
last_files_match_only. Let's use a fork to fix it until it gets merged.
havenwood pushed a commit to havenwood/ruby that referenced this pull request Apr 2, 2026
necojackarc/auto-request-review#135 fixes
last_files_match_only. Let's use a fork to fix it until it gets merged.
Copy link
Copy Markdown
Owner

@necojackarc necojackarc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for the PR 👍

@necojackarc necojackarc merged commit 5d30604 into necojackarc:master Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants