Skip to content
Compare
Choose a tag to compare
@developit developit released this 13 Jun 00:55
· 103 commits to master since this release
  • New strip-hash option to customize filename hash removal (see below) (#15, thanks @bartlomiejzuber)
  • A new experimental use-check option, which reports status as a CI Check instead of comments (#18)
  • Adjust the default file pattern to find files in subfolders (#14, thanks @VikingTristan)
  • Fix usage with Yarn's frozen-lockfile option (#5 thanks @sasurau4)
  • Add an error message when configured incorrectly (#7 thanks @gavinsharp)

Custom filename hash comparison

In v2, a new strip-hash option allows passing a custom Regular Expression pattern that is then used to remove hashes from filenames before comparison and for display purposes.

Usage & Instructions

By default, the sequence of characters matched by the regex will be removed from filenames for comparison and display purposes. The example below will convert foo.abcde.js to foo.js:

  strip-hash: "\\b\\w{5}\\."

You can customize this by using parens to create a submatch that marks where the hash occurs. When a submatch is detected, it will be replaced with asterisk characters matching its length. This is particularly useful in cases where a mix of hashed and unhashed filenames are in use. In the example below, foo.abcde.chunk.js will be replaced with foo.*****.chunk.js.

  strip-hash: "\\.(\\w{5})\\.chunk\\.js$"

Full Usage:

# <etc>
    - uses: actions/checkout@v2
    - uses: preactjs/compressed-size-action@v1
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
+       strip-hash: "\\.(\\w{5})\\.chunk\\.js$"