{"id":15540843,"url":"https://github.com/nejcm/bundle-size-reporter-action","last_synced_at":"2025-04-23T17:04:13.511Z","repository":{"id":59990149,"uuid":"540355562","full_name":"nejcm/bundle-size-reporter-action","owner":"nejcm","description":"Github action for reporting bundle size differences between branches.","archived":false,"fork":false,"pushed_at":"2024-10-09T06:54:53.000Z","size":525,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T17:04:12.368Z","etag":null,"topics":["bundle-size","github-actions","reporting"],"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/nejcm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-09-23T08:51:58.000Z","updated_at":"2025-02-12T02:49:24.000Z","dependencies_parsed_at":"2023-12-30T00:23:31.438Z","dependency_job_id":"e2330507-80f9-45b8-9e82-fc5504d1fb44","html_url":"https://github.com/nejcm/bundle-size-reporter-action","commit_stats":{"total_commits":37,"total_committers":1,"mean_commits":37.0,"dds":0.0,"last_synced_commit":"7949647d8548c51c3b4dac657ee481ad89dd029f"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejcm%2Fbundle-size-reporter-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejcm%2Fbundle-size-reporter-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejcm%2Fbundle-size-reporter-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nejcm%2Fbundle-size-reporter-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nejcm","download_url":"https://codeload.github.com/nejcm/bundle-size-reporter-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250477810,"owners_count":21437049,"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":["bundle-size","github-actions","reporting"],"created_at":"2024-10-02T12:14:38.177Z","updated_at":"2025-04-23T17:04:13.485Z","avatar_url":"https://github.com/nejcm.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bundle size reporter github action\n\nAction for reporting bundle size difference. Works with bundle size json report\nfiles (_rollup-plugin-size-snapshot_) or actual files. Check _reports_ and\n_tests_ folder in the repository for examples.\n\n## Inputs\n\n**paths** - _[Required]_ Paths to bundle size json files or folder containing\nfiles. Comma separated list.\n\n**onlyDiff** - Report only differences. Default `\"true\"`.\n\n**filter** - Regex filter based on file path.\n\n**unit** - Size unit. Default `\"KB\"`. Options\n`\"B\",\"KB\",\"MB\",\"GB\",\"TB\",\"PB\",\"EB\",\"ZB\",\"YB\"`\n\n## Outputs\n\n**summary** - `string` Table of bundle size differences in markdown format.\n\n**reports** - `object` All file/bundle reports.\n\n**hasDifferences** - `boolean` Did any bundle size change\n\n## Usage\n\n```yml\n- name: Checkout branch\n  uses: actions/checkout@v3\n  with:\n    ref: 'test' # branch to compare to\n    path: br-base # required\n    token: ${{ secrets.GITHUB_TOKEN }}\n\n- name: Bundle size report\n  uses: nejcm/bundle-size-reporter-action@v1.2.1\n  with:\n    paths: 'reports/**/*.json,assets/*'\n    onlyDiff: 'true'\n    filter: '.*\\\\.esm\\\\.js'\n```\n\n\u003e Putting `~` in front of the path will combine all files under that folder and\n\u003e just calculate the total sum. Usefull when generated files inside the folder\n\u003e have hash names that change each time.\n\n```yml\n- name: Checkout branch\n  uses: actions/checkout@v3\n  with:\n    ref: 'master' # branch to compare to\n    path: br-base # required\n    token: ${{ secrets.GITHUB_TOKEN }}\n\n- name: Bundle size report\n  uses: nejcm/bundle-size-reporter-action@v1.2.1\n  with:\n    paths: '~static/*'\n```\n\n### Github composite action\n\nThis useful\n[composite action](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action)\nwill calculate bundle size difference, post a\n[github action summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary)\nand a PR comment. First two steps are required but the others can be customized\nbased on your needs.\n\n```yml\nname: 'Bundle size reporter'\ndescription: 'Post bundle size difference compared to another branch'\ninputs:\n  branch:\n    description: 'Branch to compare to'\n    required: true\n    default: 'main'\n  paths:\n    description:\n      'Paths to json file bundle size report or folder containing bundles'\n    required: true\n    default: '/'\n  onlyDiff:\n    description: 'Report only different sizes'\n    required: false\n    default: 'false'\n  filter:\n    description: 'Regex filter based on file path'\n    required: false\n  unit:\n    description: 'Size unit'\n    required: false\n    default: 'KB'\n\n  # Comment inputs\n  comment:\n    description: 'Post comment'\n    required: false\n    default: 'true'\n  header:\n    description: 'Comment header'\n    required: false\n    default: 'Bundle size report'\n  append:\n    description: 'Append comment'\n    required: false\n    default: 'false'\n  ghToken:\n    description: 'Github token'\n    required: false\n\nruns:\n  using: 'composite'\n  steps:\n    # Checkout branch to compare to [required]\n    - name: Checkout base branch\n      uses: actions/checkout@v3\n      with:\n        ref: ${{ inputs.branch }}\n        path: br-base\n        token: ${{ inputs.ghToken }}\n\n    # Generate the bundle size difference report [required]\n    - name: Generate report\n      id: bundleSize\n      uses: nejcm/bundle-size-reporter-action@v1.4.1\n      with:\n        paths: ${{ inputs.paths }}\n        onlyDiff: ${{ inputs.onlyDiff }}\n        filter: ${{ inputs.filter }}\n        unit: ${{ inputs.unit }}\n\n    # Post github action summary\n    - name: Post summary\n      if: ${{ steps.bundleSize.outputs.hasDifferences == 'true' }} # post only in case of changes\n      run: |\n        echo '${{ steps.bundleSize.outputs.summary }}' \u003e\u003e $GITHUB_STEP_SUMMARY\n      shell: bash\n\n    # Post github action comment\n    - name: Post comment\n      uses: marocchino/sticky-pull-request-comment@v2\n      if: ${{ steps.bundleSize.outputs.hasDifferences == 'true' }} # post only in case of changes\n      with:\n        number: ${{ github.event.pull_request.number }}\n        header: ${{ inputs.header }}\n        append: ${{ inputs.append }}\n        message: '${{ steps.bundleSize.outputs.summary }}'\n        GITHUB_TOKEN: ${{ inputs.ghToken }}\n```\n\nUsing composite action\n\n```yml\n- name: 📄 Bundle size report\n  uses: ./.github/actions/bundle-size # path to composite action\n  with:\n    paths: 'reports/**/*.json'\n    onlyDiff: 'true'\n    branch: 'develop' # branch to compare to\n    header: 'Bundle size report' # PR comment header\n    ghToken: ${{ secrets.GITHUB_TOKEN }} # github token\n```\n\n## Example\n\n![Example](https://raw.githubusercontent.com/nejcm/bundle-size-reporter-action/master/example.jpg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnejcm%2Fbundle-size-reporter-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnejcm%2Fbundle-size-reporter-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnejcm%2Fbundle-size-reporter-action/lists"}