Skip to content

Warning

You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?

Bundlewatch Github Action

Actions
Run bundlewatch against your PR to keep those bundles in check! Update your package.json according to bundlewatch config
0.0.2
Star (28)

Tags

 (1)

Bundlewatch GitHub Action

This GitHub action allows you to easily run bundlewatch in your repository.

How to use:

  1. Add bundlewatch configuration in your package.json. Refer to this doc for more complete explanation.
{
  "name": "my-package",
  "bundlewatch": {
    "trackBranches": [
      "master"
    ],
    "files": [
      {
        "path": "./packages/react-isomorphic-data/dist/esm/index.js",
        "maxSize": "4.5 KB"
      }
    ]
  }
}

An example of a real-world project using this can be seen here

  1. Get a BUNDLEWATCH_GITHUB_TOKEN by following this step

  2. Set the token as a secret in your GitHub repository image

  3. Setup a workflow.yml for your tracked branch. For example, if you are tracking the bundlesize of master branch, you should create a workflow whenever a push to master happen like so:

name: "Bundlewatch Github Action - on Tracked Branches Push"

on:
  push: 
    branches:
    - master

jobs:
  bundlewatch:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: Borales/[email protected]
    - run: yarn install
    - uses: jackyef/bundlewatch-gh-action@master
      with:
        build-script: yarn build:minify
        bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

You would probably want to change the build-script to whatever script you want to run to produce your output bundle.

  1. For adding statuses on pull requests, you can add another workflow for pull requests synchronize and opened events as following:
name: "Bundlewatch Github Action"

on:
  pull_request: 
    types: [synchronize, opened]

jobs:
  bundlewatch:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: Borales/[email protected]
    - run: yarn install
    - uses: jackyef/bundlewatch-gh-action@master
      with:
        build-script: yarn build:minify
        bundlewatch-github-token: ${{ secrets.BUNDLEWATCH_GITHUB_TOKEN }}

Feedback

Feel free to open issues for feature requests. If you want to contribute, feel free to open a pull request as well!

Credits

This GitHub action will not be possible without the work done at bundlewatch. Go there and give them a star! ⭐

Bundlewatch Github Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Run bundlewatch against your PR to keep those bundles in check! Update your package.json according to bundlewatch config
0.0.2

Tags

 (1)

Bundlewatch Github Action is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.