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

[chore] .github: match components in reverse order in add-codeowners-to-pr script #38574

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

axw
Copy link
Contributor

@axw axw commented Mar 12, 2025

Description

When a component matches a file, the file is removed from the set so it won't be processed again:

# If we match a file with a component we don't need to process the file again.
FILES=$(echo -n "${FILES}" | grep -v "${FILE}")

This means that if a file cannot match multiple components. For example, I am not getting assigned to PRs that modify extension/encoding/awscloudwatchmetricstreamsencodingextension, since all of its files will first match the extension/encoding component path.

In order to assign the correct PR owners for nested components, we need to make sure we process those components before their ancestors. Each group of components is already in lexicographical order, so we can just reverse the order.

Link to tracking issue

N/A

Testing

Verified by running REPO=open-telemetry/opentelemetry-collector-contrib PR=38516 bash .github/workflows/scripts/add-codeowners-to-pr.sh with the gh calls commented out.

Documentation

N/A

When a component matches a file, the file is removed
from the set so it won't be processed again. This
means that if a file cannot match multiple components.

In order to assign the correct PR owners for nested
components, we need to make sure we process those
components before their ancestors. Each group of
components is already in lexicographical order,
so we can just reverse the order.
@axw axw requested a review from a team as a code owner March 12, 2025 10:41
@axw axw requested a review from edmocosta March 12, 2025 10:41
@mx-psi mx-psi merged commit 9ac486e into open-telemetry:main Mar 12, 2025
172 checks passed
@github-actions github-actions bot added this to the next release milestone Mar 12, 2025
@axw axw deleted the add-codeowners-to-pr-reversed branch March 13, 2025 00:13
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.

4 participants