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

feat: adds case-insensitive template matching for uses actions #353

Merged
merged 2 commits into from
Dec 25, 2024

Conversation

ubiratansoares
Copy link
Contributor

Closes #334

Improves the implementation of RepositoryUses::matches so it becomes case-insensitive regarding a provided template.

I opted for case-insensitive comparisons rather than normalizing to a lowercased template because I see this approach introducing less changes, and all of them live within a single function.

src/models.rs Outdated
Comment on lines 630 to 631
self.owner.to_lowercase() == other.owner.to_lowercase()
&& self.repo.to_lowercase() == other.repo.to_lowercase()
Copy link
Owner

Choose a reason for hiding this comment

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

The owner and repo could probably be compared with eq_ignore_ascii_case instead, to avoid a few allocations (since GH requires both to be ASCII).

The subpath and git_ref can be anything OTOH, so those look good to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Awesome input, justed learned about another small gem in Rust std 🙂

Done here

Copy link
Owner

@woodruffw woodruffw left a comment

Choose a reason for hiding this comment

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

Thanks @ubiratansoares, nice work!

@woodruffw woodruffw enabled auto-merge (squash) December 25, 2024 16:47
@woodruffw woodruffw merged commit 89b25dc into woodruffw:main Dec 25, 2024
5 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.

cache-poisoning: follow-up improvements
2 participants