{"id":27066316,"url":"https://github.com/newrelic-apps/capture-build-size","last_synced_at":"2026-05-17T01:44:23.623Z","repository":{"id":270398949,"uuid":"909136278","full_name":"newrelic-apps/capture-build-size","owner":"newrelic-apps","description":"A GitHub Action to capture a New Relic event describing your build size metrics.","archived":false,"fork":false,"pushed_at":"2025-01-06T23:23:58.000Z","size":316,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T18:52:30.214Z","etag":null,"topics":["build-size","bundle-size","webpack"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/new-relic-capture-build-size","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/newrelic-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2024-12-27T20:32:25.000Z","updated_at":"2025-03-06T22:03:50.000Z","dependencies_parsed_at":"2024-12-30T21:34:49.811Z","dependency_job_id":"32845fa0-9a54-4b9f-88cc-41eb2ac8b5c7","html_url":"https://github.com/newrelic-apps/capture-build-size","commit_stats":null,"previous_names":["newrelic/capture-build-size","newrelic-apps/capture-build-size"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/newrelic-apps/capture-build-size","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-apps%2Fcapture-build-size","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-apps%2Fcapture-build-size/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-apps%2Fcapture-build-size/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-apps%2Fcapture-build-size/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/newrelic-apps","download_url":"https://codeload.github.com/newrelic-apps/capture-build-size/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/newrelic-apps%2Fcapture-build-size/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33124932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T18:38:32.183Z","status":"ssl_error","status_checked_at":"2026-05-16T18:38:29.903Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["build-size","bundle-size","webpack"],"created_at":"2025-04-05T18:45:34.563Z","updated_at":"2026-05-17T01:44:23.600Z","avatar_url":"https://github.com/newrelic-apps.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Community Project header](https://github.com/newrelic/open-source-office/raw/master/examples/categories/images/Community_Project.png)](https://github.com/newrelic/open-source-office/blob/master/examples/categories/index.md#category-community-project)\n\n# New Relic Capture Build Size \n\n[![GitHub Marketplace version](https://img.shields.io/github/release/newrelic/capture-build-size.svg?label=Marketplace\u0026logo=github)](https://github.com/marketplace/actions/new-relic-capture-build-size)\n\nA GitHub Action to capture a New Relic event describing your build size metrics.\n\n\n## Inputs\n\n| Key | Required | Default | Description |\n| --- | --- | --- | --- |\n| `analysis-file-contents` | **If `analysis-type` is not `manual` and no `analysis-file-url` values are supplied**  | - | Build analysis file contents -- Takes precendence over analysis-file-url when both are supplied. |\n| `analysis-file-url` | **If `analysis-type` is not `manual` and no `analysis-file-contents` values are supplied**  | - | Public URL to the analysis file - When supplied without the analysis-file-contents, the action will fetch the file contents from the URL. It will decorate all events created with a link to the uploaded asset. |\n| `analysis-type` | **If using `manual-*` values, must be `manual` | `webpack` | Type of analysis file to parse. Please note: `webpack` assumes the file supplied was generated using [webpack-bundle-analyzer](https://www.npmjs.com/package/webpack-bundle-analyzer)|\n| `commit` | - | `github.sha` | Commit identifier of the build |\n| `event-type` | - | `BuildSize` | Type of event to be captured |\n| `file-name-filter` | - | - | When supplied, will only include **entrypoint** file names that include the given substring - When undefined, will include everything in the analysis file |\n| `manual-analysis-file-name` | **If `analysis-type` is `manual`** | - | Manually supply the file name of your build - Takes precendence over analysis-file-contents and analysis-file-url when supplied. Only works if analysis-type is \"manual\" |\n| `manual-analysis-file-size` | **If `analysis-type` is `manual`** | - | Manually supply the file name of your build - Takes precendence over analysis-file-contents and analysis-file-url when supplied. Only works if analysis-type is \"manual\" |\n| `manual-analysis-gzip-size` | **If `analysis-type` is `manual`** | - | Manually supply the file name of your build - Takes precendence over analysis-file-contents and analysis-file-url when supplied. Only works if analysis-type is \"manual\" |\n| `nr-account-id` | **Always** | - | New Relic Account ID to be used to capture events |\n| `nr-api-key` | **Always** | - | New Relic API key to be used to capture events |\n| `nr-env` | - | `US` | NR Environment to be used to capture events. Valid values are `US`.  `EU` to be supported in the future |\n| `traverse` | - | `false` | When true, will traverse all subtrees and capture events for each item. Currently only supports `webpack` analysis type. |\n| `trigger` | - | `github.workflow` | Trigger of the capturing the build size. Can be useful if you have differing reasons or jobs for capturing the build size across your repository. |\n| `user` | - | `github.actor` | User who triggered the build |\n| `version` | - | `github.ref_name` | Version of the build |\n\n\n## Example usage\n\n### GitHub secrets\n\n[Github secrets](https://docs.github.com/en/actions/security-guides/encrypted-secrets#about-encrypted-secrets) assumed to be set:\n* `NEW_RELIC_API_KEY` - New Relic API key\n* `NEW_RELIC_ACCOUNT_ID` - New Relic Account ID\n\n\u003e*There are a number of [default GitHub environment variables](https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables) that are used in these examples as well.*\n### Minimum required fields - analysis-file-url\n\n```yaml\nname: Capture Build Size With New Relic\non:\n  workflow_dispatch:\n  push:\n\njobs:\n  report-build-size:\n    runs-on: ubuntu-latest\n    name: Report Webpack Stats To New Relic\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      # This step parses the build stats (URL) and creates NR events\n      - name: Capture Build Size\n        uses: newrelic/capture-build-size@v1.0.0\n        with:\n          analysis-file-url: https://foo.bar/mybuild.stats.json\n          nr-account-id: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}\n          nr-api-key: ${{ secrets.NEW_RELIC_API_KEY }}\n```\n\n### Minimum required fields - analysis-file-contents\n\n```yaml\nname: Capture Build Size With New Relic\non:\n  workflow_dispatch:\n  push:\n\njobs:\n  report-build-size:\n    runs-on: ubuntu-latest\n    name: Report Webpack Stats To New Relic\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      # This step builds the code (and includes the webpack-bundle-analyzer)\n      - name: Build \n        run: npm run build\n      # This step reads the locally made stats file (assuming to be located in \"./build\")\n      - name: Get local stats file\n        id: get-stats\n        shell: bash\n        run: |\n            stats=$(cat ./build/mybuild.stats.json); echo \"stats=$stats\" \u003e\u003e $GITHUB_OUTPUT;\n      # This step parses the Build stats (file) and creates NR events\n      - name: Capture Build Size\n        uses: newrelic/capture-build-size@v1.0.0\n        with:\n          analysis-file-contents: ${{ steps.get-stats.output.stats }}\n          nr-account-id: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}\n          nr-api-key: ${{ secrets.NEW_RELIC_API_KEY }}\n```\n\n### Minimum required fields - manual-*\n```yaml\nname: Capture Build Size With New Relic\non:\n  workflow_dispatch:\n  push:\n\njobs:\n  report-build-size:\n    runs-on: ubuntu-latest\n    name: Report Webpack Stats To New Relic\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      # This step builds the code\n      - name: Build \n        run: npm run build\n      # This step parses the Build stats (file) and creates NR events\n      - name: Capture Build Size\n        uses: newrelic/capture-build-size@v1.0.0\n        with:\n          analysis-type: 'manual'\n          manual-analysis-file-name: 'main-Build' # the file name to report\n          manual-analysis-file-size: 12345 # Some value calculated manually\n          nr-account-id: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}in your build steps that does not rely on an explicit analysis file like webpack-build-analyzer \n          nr-api-key: ${{ secrets.NEW_RELIC_API_KEY }}\n```\n\n### All input fields example - analysis-file-url\n```yaml\nname: Capture Build Size With New Relic\non:\n  pull_request: # run on pull request sync events\n\njobs:\n  report-build-size:\n    runs-on: ubuntu-latest\n    name: Report Webpack Stats To New Relic\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v4\n      # This step parses the Build stats (URL) and creates NR events\n      - name: Capture Build Size\n        uses: newrelic/capture-build-size@v1.0.0\n        with:\n          analysis-file-url: https://foo.bar/mybuild.stats.json # the webpack stats file URL\n          analysis-type: 'webpack' # parse a webpack stats file\n          commit: ${{ github.sha }} # the commit that triggered the action\n          event-type: 'MyBuildSize' # report the event with a custom event type\n          file-name-filter: '.min.js' # only include entrypoints that are minified\n          nr-account-id: ${{ secrets.NEW_RELIC_ACCOUNT_ID }} # US environment account\n          nr-api-key: ${{ secrets.NEW_RELIC_API_KEY }} # US environment api key\n          nr-env: 'US' # US environment\n          traverse: true # Will create events for each sub-file in the analysis file\n          trigger: 'PR' # Indicate the build was tied to a PR \n          user: ${{ github.actor }} # the user who raised the PR\n          version: ${{ github.ref_name }} # the PR number tied to the action\n```\n\n\n## Query Your Data\n\n  \n### Basic Query Steps\n1. In NR1, log into the account you pointed the action to report to.\n2. Select \"Query your data\"\n3. Run the given NRQL query\n\n### Attributes Potentially Available\n- \"analysisFileUrl\"\n- \"analysisType\"\n- \"commit\"\n- \"entryPoint\"\n- \"fileName\"\n- \"fileSize\"\n- \"gzipSize\"\n- \"isInitialEntrypoint\"\n- \"timestamp\"\n- \"trigger\"\n- \"user\"\n- \"version\"\n\n### Track Webpack Entrypoint Sizes Over Time\nThis example assumes you are collecting `BuildSize` events every time your main branch changes\n```sql\nFROM BuildSize select latest(fileSize)/1000 as 'KB' where isInitialEntrypoint where version = 'main' facet fileName timeseries since 1 week ago\n```\n\n### Track Webpack Async Chunk Sizes Over Time\nThis example assumes you are collecting `BuildSize` events every time your main branch changes\n```sql\nFROM BuildSize select latest(fileSize)/1000 as 'KB' where isInitialEntrypoint is not true where version = 'main' facet fileName timeseries since 1 week ago\n```\n\n### Compare Build Sizes Across PRs\nThis examples assumes you are collecting `BuildSize` events every time your main branch changes as well as when a PR is created/updated.  Each PR `BuildSize` will have a `version` attribute matching its PR number.\n```sql\nFROM BuildSize select latest(fileSize)/1000 as 'KB', latest(gzipSize)/1000 as 'GZIP KB', latest(timestamp), latest(commit) as 'SHA' where fileName = \u003cfile name\u003e facet version\n```\n\n### Evaluate deviation across PRs\nThis examples assumes you are collecting `BuildSize` events every time your main branch changes as well as when a PR is created/updated.  Each PR `BuildSize` will have a `version` attribute matching its PR number.\n\n```sql\nFROM BuildSize select stddev(fileSize)/1000 as 'Stddev KB' where fileName = \u003cfile name\u003e facet version\n```\n\n### Evaluate builds created by a user\nThis examples assumes you are collecting `BuildSize` events every time your main branch changes as well as when a PR is created/updated.  Each PR `BuildSize` will have a `version` attribute matching its PR number.\n\n```sql\nFROM BuildSize select latest(fileSize)/1000 as 'KB', latest(gzipSize)/1000 as 'GZIP KB', latest(timestamp), latest(commit) as 'SHA' where fileName = \u003cfile name\u003e and user = \u003cuser id\u003e facet version\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic-apps%2Fcapture-build-size","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnewrelic-apps%2Fcapture-build-size","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnewrelic-apps%2Fcapture-build-size/lists"}