github / webpack-bundlesize-compare-action

A github action that outputs bundlesize comparison tables for pull requests
MIT License
78 stars 19 forks source link

Comment incorrectly reports no change #535

Open RobinClowers opened 10 months ago

RobinClowers commented 10 months ago

Thanks for publishing this action. Unfortunately, it doesn't seem to be working for me, I generated 2 stats files from different commits, but the comment on the PR says there is no change. Here is a partial diff between the two stat files:

-    "label": "main.ef4c6927.js",
+    "label": "main.1baa3a0e.js",
     "isAsset": true,
-    "statSize": 9680463.559999999,
-    "parsedSize": 3571859,
-    "gzipSize": 1026459,
+    "statSize": 9813627.559999999,
+    "parsedSize": 3610758,
+    "gzipSize": 1039000,

You can see the new main bundle is ~39k larger. Any idea what I might be doing wrong? I've included my full workflow below.

jobs:
  main-bundle-stats:
    name: Calculate main bundle stats
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: e2e1a19e6f4c5e43d2ed84167317c679099093c1 # only for testing purposes
        # with:
        # ref: ${{ github.base_ref }}
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: "yarn"
      - run: yarn install --frozen-lockfile
      - run: yarn build:analyze:json
      - name: Upload main-bundle-stats.json
        uses: actions/upload-artifact@v3
        with:
          name: main-bundle-stats.json
          path: ./dist/report.json

  head-bundle-stats:
    name: Calculate head bundle stats
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 18
          cache: "yarn"
      - run: yarn install --frozen-lockfile
      - run: yarn build:analyze:json
      - name: Upload main-bundle-stats.json
        uses: actions/upload-artifact@v3
        with:
          name: head-bundle-stats.json
          path: ./dist/report.json

  report-bundle-size:
    name: Report bundle size difference
    runs-on: ubuntu-latest
    needs: [main-bundle-stats, head-bundle-stats]
    permissions:
      pull-requests: write
    steps:
      - uses: actions/download-artifact@v3
      - uses: github/webpack-bundlesize-compare-action@v1
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          current-stats-json-path: ./head-bundle-stats.json
          base-stats-json-path: ./main-bundle-stats.json
shimizukawa commented 8 months ago

Same for me.