Giter Site home page Giter Site logo

chrysanthos / simple-asset-size-reporter Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 6.0 7.34 MB

A Github Action to easily identify asset size increase (or decrease) in your PRs

JavaScript 100.00%
github-actions github-actions-ci asset-management review-tools code-review laravel treeware

simple-asset-size-reporter's Introduction

Abandoned

This project is no longer being actively developed. Please use https://github.com/ai/size-limit instead.

Simple Asset Size Reporter

This action will calculate the size of your assets for each PR and comment when the filesize is bigger than the one in the master branch.

The defaults are set so that most projects work out of the box (e.g. Laravel projects) but it is easily tweaked to work with any web framework.

Example usage

Create a file named .github/workflows/simple-size-check.yml in your repo and add the following:

name: Simple Asset Size Reporter

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2-beta
      with:
        fetch-depth: 0
    - uses: chrysanthos/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        files: '["public/js/*.js", "public/css/*.css"]'
        with-same: 'false'
        build-assets: 'false'

Comment example on a PR

Usage

repo-token (Required)

The github token to be used.

files (Optional)

The asset files to be checked. This needs to be a json encoded array of regex paths.

Defaults to: '["public/js/.js", "public/css/.css"]'.

build-assets (Optional)

In case you do not commit the compiled assets inside your repository and need compiling this the place to put your build command. When this is set to auto it will detect whether you use npm or yarn and run the appropriate command (i.e. npm run prod or yarn run prod) to build your assets.

with-same (Optional)

If you want the report to include the files that their size did not change set this to 'true'.

Full example

name: Simple Asset Size Reporter

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2-beta
      with:
        fetch-depth: 0
    - uses: chrysanthos/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
        files: '["public/js/*.js", "public/css/*.css"]'
        with-same: 'true'
        build-assets: 'npm run prod'

Credits

Initial work: simplabs/ember-asset-size-action

License

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

simple-asset-size-reporter's People

Contributors

chrysanthos avatar mydea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

simple-asset-size-reporter's Issues

Error when running github action

I am seeing the following error:

 Run chrysanthos/[email protected]
2s
    build-assets: false
Run chrysanthos/[email protected]
  with:
    repo-token: ***
    files: ["dist/.js"]
    with-same: false
    build-assets: false
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
[@octokit/rest] `const Octokit = require("@octokit/rest")` is deprecated. Use `const { Octokit } = require("@octokit/rest")` instead
/usr/bin/git checkout 60ed245099341642e9714b70b9c0e054f619acdd
Previous HEAD position was 80f95fbc Merge 463a7e29c72a18616f39ead8afe118435775b76c into 60ed245099341642e9714b70b9c0e054f619acdd
HEAD is now at 60ed2450 feat(git actions): add bundle watch (#7)
Could not create a comment automatically.
##[error]body is not defined

I'm not sure how to troubleshoot this. Any help is appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.