{"id":15048128,"url":"https://github.com/github/webpack-bundlesize-compare-action","last_synced_at":"2025-04-04T19:05:56.169Z","repository":{"id":36982299,"uuid":"445939646","full_name":"github/webpack-bundlesize-compare-action","owner":"github","description":"A github action that outputs bundlesize comparison tables for pull requests","archived":false,"fork":false,"pushed_at":"2025-03-28T02:05:46.000Z","size":5743,"stargazers_count":84,"open_issues_count":11,"forks_count":23,"subscribers_count":207,"default_branch":"main","last_synced_at":"2025-03-28T13:02:06.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-08T22:12:10.000Z","updated_at":"2025-03-25T20:45:04.000Z","dependencies_parsed_at":"2024-11-04T13:36:42.629Z","dependency_job_id":"594df64a-f541-4bd1-ba05-045508482704","html_url":"https://github.com/github/webpack-bundlesize-compare-action","commit_stats":{"total_commits":567,"total_committers":16,"mean_commits":35.4375,"dds":"0.25749559082892415","last_synced_commit":"2654401aca0183f36c07dbf84b55103546873238"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fwebpack-bundlesize-compare-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fwebpack-bundlesize-compare-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fwebpack-bundlesize-compare-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fwebpack-bundlesize-compare-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/webpack-bundlesize-compare-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247110669,"owners_count":20885299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T21:08:28.009Z","updated_at":"2025-04-04T19:05:56.149Z","avatar_url":"https://github.com/github.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack bundlesize compare action\n\nAn action that compares 2 webpack compilation stats files, and comments on the PR with a description of the difference\n\n## How to use it\n\nIn your application, ensure you output the stats.json, from `BundleAnalyzerPlugin'\n\n```js\n// webpack.config.js\nconst {BundleAnalyzerPlugin} = require('webpack-bundle-analyzer')\n\n// optionally you can also output compressed/gzipped stats. Requires a version \u003e=1.1.0\nconst CompressionPlugin = require('compression-webpack-plugin')\n\nmodule.exports = {\n  plugins: [\n    ...plugins,\n    // not required\n    new CompressionPlugin(),\n\n    // required\n    new BundleAnalyzerPlugin({\n      // generate the stats.json file\n      generateStatsFile: true\n    })\n  ]\n}\n```\n\nThen, in your action configuration, build both the head and the branch (in any way you see fit) and pass paths to the stats.json files as inputs ot this action\n\n```yaml\n# .github/workflows/bundlesize-compare.yml\n\non:\n  # this action will error unless run in a pr context\n  pull_request:\n  pull_request_target:\n\njobs:\n  # Build current and upload stats.json\n  # You may replace this with your own build method. All that\n  # is required is that the stats.json be an artifact\n  build-head:\n    name: 'Build head'\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          ref: ${{github.event.pull_request.head.ref}}\n      - name: Install dependencies\n        run: npm ci\n      - name: Build\n        run: npm run build\n      - name: Upload stats.json\n        uses: actions/upload-artifact@v4\n        with:\n          name: head-stats\n          path: ./dist/stats.json\n\n  # Build base for comparison and upload stats.json\n  # You may replace this with your own build method. All that\n  # is required is that the stats.json be an artifact\n  build-base:\n    name: 'Build base'\n    runs-on: ubuntu-latest\n    permissions:\n      contents: read\n    steps:\n      - uses: actions/checkout@v4\n        with:\n          ref: ${{ github.base_ref }}\n      - name: Install dependencies\n        run: npm ci\n      - name: Build\n        run: npm run build\n      - name: Upload stats.json\n        uses: actions/upload-artifact@v4\n        with:\n          name: base-stats\n          path: ./dist/stats.json\n\n  # run the action against the stats.json files\n  compare:\n    name: 'Compare base \u0026 head bundle sizes'\n    runs-on: ubuntu-latest\n    needs: [build-base, build-head]\n    permissions:\n      pull-requests: write\n    steps:\n      - uses: actions/download-artifact@v4\n      - uses: github/webpack-bundlesize-compare-action@v2.1.0\n        with:\n          github-token: ${{ secrets.GITHUB_TOKEN }}\n          current-stats-json-path: ./head-stats/stats.json\n          base-stats-json-path: ./base-stats/stats.json\n```\n\nThis action requires the `write` permission for the [`permissions.pull-requests` scope](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idpermissions).\n\n## Options\n\n| name                    | description                                                                                                         | required | type   |\n| ----------------------- | ------------------------------------------------------------------------------------------------------------------- | -------- | ------ |\n| current-stats-json-path | The path to the current stats.json file                                                                             | true     | string |\n| base-stats-json-path    | The path to the base stats.json file                                                                                | true     | string |\n| github-token            | The Github token                                                                                                    | true     | string |\n| title                   | An optional addition to the title, which also helps key comments, useful if running more than 1 copy of this action | false    | string |\n\n| describe-assets         | Option for asset description output. One of \"all\" (default), \"changed-only\", or \"none\". | false    | string |\n\n## Example PR Comment\n\nhttps://github.com/github/webpack-bundlesize-compare-action/pull/50#issuecomment-1054919780\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fwebpack-bundlesize-compare-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fwebpack-bundlesize-compare-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fwebpack-bundlesize-compare-action/lists"}