Skip to content

bitgaming/compressed-size-action

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

compressed-size-action

A GitHub action that reports changes in compressed file sizes on your PRs.

  • Automatically uses yarn or npm ci when lockfiles are present
  • Builds your PR, then builds the target and compares between the two
  • Doesn't upload anything or rely on centralized storage

Usage:

Add a workflow (.github/workflows/main.yml):

name: Compressed Size

on: [pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: preactjs/compressed-size-action@v1
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

Customizing the Build

By default, compressed-size-action will try to build your PR by running the "build" npm script in your package.json.

If you need to perform some tasks after dependencies are installed but before building, you can use a "postinstall" npm script to do so. For example, in Lerna-based monorepo:

{
  "scripts": {
    "postinstall": "lerna bootstrap",
    "build": "lerna run build"
  }
}

It is also possible to define a "prebuild" npm script, which runs after "postinstall" but before "build".

You can also specify a completely different npm script to run instead of the default ("build"). To do this, add a build-script option to your yml workflow:

name: Compressed Size

on: [pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - uses: preactjs/compressed-size-action@v1
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
+       build-script: "ci"

About

GitHub Action that adds compressed size changes to your PRs.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%