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

audit(github): also permit refs/heads in GitHub URLs #16155

Merged
merged 1 commit into from
Oct 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions Library/Homebrew/rubocops/urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@
problem "Use /archive/ URLs for GitHub tarballs (url is #{url})."
end

archive_ref_tags_gh_pattern = %r{https://.*github.*/archive/(?![a-fA-F0-9]{40})(?!refs/tags/).*\.tar\.gz$}
audit_urls(urls, archive_ref_tags_gh_pattern) do |_, url|
archive_refs_gh_pattern = %r{https://.*github.+/archive/(?![a-fA-F0-9]{40})(?!refs/(tags|heads)/)(.*)\.tar\.gz$}
audit_urls(urls, archive_refs_gh_pattern) do |match, url|
next if url.end_with?(".git")

problem "Use /archive/refs/tags URLs for GitHub tarballs (url is #{url})."
problem "Use refs/tags/#{match[2]} or refs/heads/#{match[2]} for GitHub references (url is #{url})."

Check warning on line 224 in Library/Homebrew/rubocops/urls.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/rubocops/urls.rb#L224

Added line #L224 was not covered by tests
end

# Don't use GitHub .zip files
Expand Down