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

Simplify glob pattern #2569

Merged
merged 2 commits into from
Feb 17, 2025
Merged

Simplify glob pattern #2569

merged 2 commits into from
Feb 17, 2025

Conversation

trask
Copy link
Member

@trask trask commented Feb 13, 2025

Follow-up to @chalin's #2548 (comment)

Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

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

Actually, what I was alluding to earlier is that foo/**/** could be simplified to foo/** to match the branches that I think we want to match.

It worked in the OTel.io settings:

image

Note the match given the pattern opentelemetrybot/**.

According to the GH docs, https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/creating-rulesets-for-a-repository#using-fnmatch-syntax. The base docs of fnmatch are https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch.

According to Copilot:

When applied to branch names, the ** pattern in fnmatch matches substrings recursively, treating slashes as ordinary characters.

The quote above supports my claim that ** should be enough. WDYT?

@trask
Copy link
Member Author

trask commented Feb 13, 2025

I tried otelbot/** but it didn't match a branch named otelbot/one/two

@chalin
Copy link
Contributor

chalin commented Feb 13, 2025

I tried otelbot/** but it didn't match a branch named otelbot/one/two

Yeah, I can see that.

Funny: to me abc/**/* should not match abc/def because of the two slashes in the pattern; but I guess I'm reading this too much like a regex rather than a (file) glob pattern -- even though branch names aren't path names.

Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

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

👍🏻

@trask trask merged commit 0112893 into open-telemetry:main Feb 17, 2025
4 checks passed
@trask trask deleted the simplify-glob branch February 17, 2025 16:09
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