{"id":20047907,"url":"https://github.com/chronotruck/webpack-stats-diff-action","last_synced_at":"2025-05-05T10:31:27.334Z","repository":{"id":40729208,"uuid":"236504965","full_name":"chronotruck/webpack-stats-diff-action","owner":"chronotruck","description":"Github action to print Webpack stat diffs in your pull-requests.","archived":false,"fork":false,"pushed_at":"2024-02-14T14:46:32.000Z","size":497,"stargazers_count":33,"open_issues_count":11,"forks_count":10,"subscribers_count":2,"default_branch":"dev","last_synced_at":"2025-04-08T21:22:45.165Z","etag":null,"topics":["actions","bundle-size","monitoring","webpack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chronotruck.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-27T14:10:54.000Z","updated_at":"2025-04-08T17:51:51.000Z","dependencies_parsed_at":"2024-06-21T05:46:32.157Z","dependency_job_id":"e4dde784-a785-430f-8b38-08acf8221835","html_url":"https://github.com/chronotruck/webpack-stats-diff-action","commit_stats":{"total_commits":12,"total_committers":3,"mean_commits":4.0,"dds":"0.16666666666666663","last_synced_commit":"a3fd5dabec615eb50587b695cb4d6eb83166ad77"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chronotruck%2Fwebpack-stats-diff-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chronotruck%2Fwebpack-stats-diff-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chronotruck%2Fwebpack-stats-diff-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chronotruck%2Fwebpack-stats-diff-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chronotruck","download_url":"https://codeload.github.com/chronotruck/webpack-stats-diff-action/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252480464,"owners_count":21754777,"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":["actions","bundle-size","monitoring","webpack"],"created_at":"2024-11-13T11:39:26.108Z","updated_at":"2025-05-05T10:31:26.295Z","avatar_url":"https://github.com/chronotruck.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Webpack Stats Diff\n\nCreates a comment inside your Pull-Request with the difference between two Webpack stats files.\n\n![Comment demo](./docs/splash.png)\n\n## Usage\n\nTo use this Github action, in your steps you may have:\n\n```yml\nuses: chronotruck/webpack-stats-diff-action@1.0.0\nwith:\n  base_stats_path: '/path/to/my/stats.json'\n  head_stats_path: '/path/to/my/stats.json'\n  token: ${{ secrets.GITHUB_TOKEN }}\n  comment_title: 'Custom title'\n  announcement_percentage_threshold_increase: 0\n  announcement_percentage_threshold_decrease: -1.0\n```\n\n## Inputs\n\n| Inputs          | Required | Default           | Description                                                                                   |\n|-----------------|----------|-------------------|-----------------------------------------------------------------------------------------------|\n| base_stats_path | true     |                   | Path to the Webpack generated \"stats.json\" file from the base branch.                         |\n| head_stats_path | true     |                   | Path to the Webpack generated \"stats.json\" file from the head branch.                         |\n| token           | true     |                   | Github token so the package can publish a comment in the pull-request when the diff is ready. |\n| comment_title   | false    |'Bundle difference'| Customized GitHub comment title.                                                              |\n| announcement_percentage_threshold_increase | false | undefined | Only announces bundle difference when the diff percentage increase exceeds this value.  The value should be a positive numeric value (integer or floating point) or zero. |\n| announcement_percentage_threshold_decrease | false | undefined | Only announces bundle difference when the diff percentage decrease exceeds this value. The value should be a negative numeric value (integer or floating point) or zero.|\n\n## Usage example\n\nIf you want to compare the bundle size difference between your base branch and your pull-request head branch.\n\nWe suppose that when you build your webpack app, a `stats.json` file is created. See https://github.com/webpack-contrib/webpack-bundle-analyzer for usage examples.\n\nYou'll need to build your Webpack bundle for the head branch:\n\n```yml\non:\n  pull_request:\n\njobs:\n  build-head:\n    name: 'Build head'\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v1\n    - name: Install dependencies\n      run: npm ci\n    - name: Build\n      run: npm run build\n```\n\nThen we will use the Github Actions feature called \"[artifacts](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts)\" to store that `stats.json` file.\n\n```yml\n    - name: Upload stats.json\n      uses: actions/upload-artifact@v1\n      with:\n        name: head-stats\n        path: ./dist/stats.json\n```\n\nNow you can do the exact same thing, but for the base branch. Note the checkout step!\n\n```yml\n  build-base:\n    name: 'Build base'\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v1\n      with:\n        ## Here we do not checkout the current branch, but we checkout the base branch.\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@v1\n      with:\n        name: base-stats\n        path: ./dist/stats.json\n```\n\nNow, in a new job we can retrieve both of our saved stats from the artifacts and use this action to compare them.\n\n```yml\n  compare:\n    name: 'Compare base \u0026 head bundle sizes'\n    runs-on: ubuntu-latest\n    needs: [build-base, build-head]\n    steps:\n    - uses: actions/checkout@v1\n    - name: Download base artifact\n      uses: actions/download-artifact@v1\n      with:\n        name: base-stats\n    - name: Download head artifact\n      uses: actions/download-artifact@v1\n      with:\n        name: head-stats\n    - name: Diff between base \u0026 head\n      uses: chronotruck/webpack-stats-diff-action@1.0.0\n      with:\n        token: ${{ secrets.GITHUB_TOKEN }}\n        base_stats_path: ./base-stats/stats.json\n        head_stats_path: ./head-stats/stats.json\n```\n\nThat's it! When the compare job will be executed, it will post a comment in the current pull-request with the difference between the two stats.json files.\n\n## License\n\nThis project is licensed under MIT License.\nOpen source time proudly sponsored by [Chronotruck](https://developers.chronotruck.com/?ref=github-webpack-stats-diff).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchronotruck%2Fwebpack-stats-diff-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchronotruck%2Fwebpack-stats-diff-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchronotruck%2Fwebpack-stats-diff-action/lists"}