Skip to content
bar-chart-2

GitHub Action

Less is more - artifact size

v1.0.0 Latest version

Less is more - artifact size

bar-chart-2

Less is more - artifact size

Be aware of the increase percentage of your artifact

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Less is more - artifact size

uses: caponetto/[email protected]

Learn more about this action in caponetto/less-is-more

Choose a version

CI CodeQL License: MIT GitHub release

less-is-more

This workflow will simply fail if the current artifact size has increased more than what is allowed when compared to the latest released artifact. It could be very useful to early identify unwanted size increases, especially on workflows that run for pull requests.

Required input arguments

Name Type Description
released_artifact_name string The filename of the released artifact (or a unique part of it).
artifact_path string The path of the current artifact (or a unique part of it).
max_increase_percentage int>0 The maximum increase percentage allowed.

Optional input arguments

Name Type Description Default
github_token string The token to authenticate Octokit (increases your API rate limit). ""
fail_execution boolean Fail the execution if the artifact is bigger than allowed. true

Usage

Example: I want this workflow to fail if the artifact size that I'm building at dist/my-artifact.zip has increased more than 10% when compared to my-released-artifact, which is located on GitHub's releases page.

Note: If your released artifact contains variable parts, such as version, you can omit it. So my-released-artifact_v1.0.0.zip can be simply my-released-artifact, or even my-released-artifact_*.zip.

# Build the artifact before using this workflow.

- uses: caponetto/less-is-more@v1
  with:
    released_artifact_name: my-released-artifact
    artifact_path: dist/my-artifact.zip
    max_increase_percentage: 10
    github_token: ${{ secrets.MY_TOKEN }}

Contribute

All contributions are welcome, so don't hesitate to submit a pull request. ;-)

License

This code is released under MIT License.

Check LICENSE file for more information.