Skip to content

Add user agent to HTMLProofer#22127

Merged
samford merged 1 commit intomainfrom
add-user-agent-to-html-proofer
May 2, 2026
Merged

Add user agent to HTMLProofer#22127
samford merged 1 commit intomainfrom
add-user-agent-to-html-proofer

Conversation

@samford
Copy link
Copy Markdown
Member

@samford samford commented May 2, 2026


  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes. Non-maintainers may only have one AI-assisted/generated PR open at a time.

The brew documentation tests use HTMLProofer to check for broken links in generated documentation HTML and this is causing all brew PRs to fail CI because one of the linked pages will return a JavaScript challenge page if the request uses a user agent that the server doesn't like (or no user agent at all). The default HTMLProofer user agent is "Mozilla/5.0 (compatible; HTML Proofer/5.2.1; +https://github.com/gjtorikian/html-proofer)" and, for whatever reason, the Mozilla user agent triggers the upstream server's scraper safeguards.

This updates docs/Rakefile to use a generic "HTMLProofer/5.2.1" user agent for these requests, which addresses this particular failure. I've set this up to conditionally prepend HOMEBREW_USER_AGENT if it's available in the environment, though it's not currently present in this context, so I can drop that if it's not wanted/needed.

Copilot AI review requested due to automatic review settings May 2, 2026 19:58
@samford samford force-pushed the add-user-agent-to-html-proofer branch from 61cd2b3 to 483d4d0 Compare May 2, 2026 20:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the documentation link-check task to send a custom User-Agent with HTMLProofer requests, aiming to avoid CI failures caused by servers rejecting the default request profile.

Changes:

  • Refactors the HTMLProofer invocation to build options in an args hash first.
  • Reads HOMEBREW_USER_AGENT from the environment during the docs test task.
  • Adds Typhoeus request headers so HTMLProofer requests send a User-Agent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/Rakefile Outdated
Comment thread docs/Rakefile Outdated
Comment thread docs/Rakefile Outdated
Comment thread docs/Rakefile Outdated
@samford samford force-pushed the add-user-agent-to-html-proofer branch 3 times, most recently from d6ab584 to 43aaa84 Compare May 2, 2026 20:09
@samford
Copy link
Copy Markdown
Member Author

samford commented May 2, 2026

Ahh yeah, HOMEBREW_USER_AGENT isn't available in this context. Let me tinker with this some more.

@samford samford force-pushed the add-user-agent-to-html-proofer branch from 43aaa84 to ca0d51f Compare May 2, 2026 20:14
The brew documentation tests use `HTMLProofer` to check for broken
links in generated documentation HTML and this is causing all brew PRs
to fail CI because one of the linked pages will return a JavaScript
challenge page if the request uses a user agent that the server
doesn't like (or no user agent at all). The default `HTMLProofer` user
agent is "Mozilla/5.0 (compatible; HTML Proofer/5.2.1;
+https://github.com/gjtorikian/html-proofer)" and, for whatever
reason, the Mozilla user agent triggers the upstream server's scraper
safeguards.

This updates docs/Rakefile to use a generic `HTMLProofer/5.2.1` user
agent for these requests, which addresses this particular failure.
I've set this up to conditionally prepend `HOMEBREW_USER_AGENT` if
it's available in the environment, though it's not currently present
in this context.
@samford samford force-pushed the add-user-agent-to-html-proofer branch from ca0d51f to 8b39e4e Compare May 2, 2026 20:28
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM when 🟢. Merge sooner rather than later to unblock CI 🙇🏻

@samford samford added this pull request to the merge queue May 2, 2026
Merged via the queue into main with commit bff565a May 2, 2026
45 of 48 checks passed
@samford samford deleted the add-user-agent-to-html-proofer branch May 2, 2026 21:20
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