preactjs / compressed-size-action

GitHub Action that adds compressed size changes to your PRs.
https://github.com/marketplace/actions/compressed-size-action
MIT License
601 stars 84 forks source link

minimum-change-threshold not taking effect #102

Closed pauldambra closed 10 months ago

pauldambra commented 11 months ago

Hey,

We have this config

            - name: Check toolbar bundle size
              if: needs.changes.outputs.frontend == 'true'
              uses: preactjs/compressed-size-action@v2
              with:
                  build-script: 'build'
                  compression: 'none'
                  pattern: 'frontend/dist/toolbar.js'
                  minimum-change-threshold: 100

The action runs correctly. But we added the minimum-change-threshold: 100 and it isn't taking effect.

You can see here that we're getting the comment despite 0B change https://github.com/PostHog/posthog/pull/19014#issuecomment-1835980534

Am I doing something silly?

rschristian commented 10 months ago

You're not doing anything silly, that's operating as intended.

minimum-change-threshold only determines what files show up as "Changed" or "Unchanged" -- in your example, frontend/dist/toolbar.js could grow by 99b and still would fall under "Unchanged". The comment itself will always display.


Increasing the required threshold

By default, a file that's been changed by a single byte will be reported as changed. If you'd prefer to require a certain minimum threshold for a file to be changed, you can specify minimum-change-threshold in bytes:

minimum-change-threshold: 100

In the above example, a file with a delta of less than 100 bytes will be reported as unchanged.