anishathalye / proof-html

A GitHub Action to validate HTML, check links, and more ✅
MIT License
58 stars 21 forks source link

Feature request: dynamic parameter handling #1

Closed bmaupin closed 1 year ago

bmaupin commented 1 year ago

Hi,

For a while I'd been using this action instead: https://github.com/chabad360/htmlproofer

However, that action isn't pinned to a specific version of htmlproofer so it keeps breaking due to breaking changes upstream.

I like how this GitHub Action is pinned to a specific version of htmlproofer (even if it's an old one), however I noticed that there are only options for a limited number of CLI parameters.

For example, here are some of the parameters I need that this action doesn't provide as options:

The simplest approach might be to add those missing options, but instead my proposal would be to add dynamic parameter handling, which is used by the aforementioned action (https://github.com/chabad360/htmlproofer). If you look there, it looks like they accept all arguments to htmlproofer as one option (arguments): https://github.com/chabad360/htmlproofer/blob/master/action.yml#L9

... and then they parse those in the entrypoint using xargs: https://github.com/chabad360/htmlproofer/blob/84d8858062ae9927f3ce73dcaa29c496b159f092/entrypoint.sh#L7

This seems much more future-proof because htmlproofer has gone through several breaking changes to the parameters, and much less work to maintain for this project.

In the meantime I've come up with a workaround:

      - name: Check internal links using htmlproofer
        uses: anishathalye/proof-html@v1.4.0
        with:
          entrypoint: htmlproofer
          args: _site --assume_extension --disable-external --empty-alt-ignore --url-ignore "_,#" --url-swap "^/wiki:"

Thanks!

anishathalye commented 1 year ago

The main reason that this action uses Ruby code and HTMLProofer.check_directory, iirc, is that the command-line htmlproofer didn't support RegEx URL ignore patterns (with --url-ignore), only strings. This action allows specifying url_ignore_re, which are parsed as regular expressions. Another feature that this action supports that isn't supported out-of-the-box with using htmlproofer directly is retries. Another feature is supporting auth tokens, which also aren't accessible through the htmlproofer CLI interface, only the Ruby interface. So I don't want to switch to just using htmlproofer directly.

I'm happy to upgrade to a more recent version of HTMLProofer if that would be helpful.

I haven't needed those particular parameters that you need that are in the CLI but missing from this action, but I'm happy to add them / maybe we should just add all of them, to have feature parity. Shouldn't be too hard to stay in sync going forward, either. Thoughts?

bmaupin commented 1 year ago

That makes sense, I didn't realize that this action was doing more than the htmlproofer CLI!

It's really up to you whether or not you'd like to upgrade HTMLProofer and/or add the missing parameters. I'm only using it in a very small project and my workaround should meet my needs for a very long time.

Thanks!