{"id":16528382,"url":"https://github.com/danvk/travis-weigh-in","last_synced_at":"2025-08-03T15:32:03.600Z","repository":{"id":57379361,"uuid":"44832851","full_name":"danvk/travis-weigh-in","owner":"danvk","description":"Track how each commit/pull request affects the size of a file in your repo","archived":false,"fork":false,"pushed_at":"2015-10-30T16:06:19.000Z","size":207,"stargazers_count":32,"open_issues_count":8,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-14T11:22:50.636Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/danvk.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}},"created_at":"2015-10-23T19:05:06.000Z","updated_at":"2024-01-04T17:20:03.000Z","dependencies_parsed_at":"2022-09-02T20:41:30.028Z","dependency_job_id":null,"html_url":"https://github.com/danvk/travis-weigh-in","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/danvk/travis-weigh-in","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftravis-weigh-in","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftravis-weigh-in/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftravis-weigh-in/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftravis-weigh-in/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danvk","download_url":"https://codeload.github.com/danvk/travis-weigh-in/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvk%2Ftravis-weigh-in/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268567242,"owners_count":24271330,"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","status":"online","status_checked_at":"2025-08-03T02:00:12.545Z","response_time":2577,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-10-11T17:40:08.552Z","updated_at":"2025-08-03T15:32:03.554Z","avatar_url":"https://github.com/danvk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":" [![NPM version](http://img.shields.io/npm/v/travis-weigh-in.svg)](https://www.npmjs.org/package/travis-weigh-in)\n \n# travis-weigh-in\nTrack how each commit/pull request affects the size of a file in your repo.\n\nYou are what you measure! This script lets you track the size of a generated file (e.g. your minified JavaScript bundle) as it's changed by each Pull Request and commit in your GitHub repo. Here's what the Pull Request Statuses section looks like after you've set it up:\n\n![status with weigh-in](https://cloud.githubusercontent.com/assets/98301/10703019/161a9d40-799b-11e5-9798-8ebbab465d02.png)\n\nThe last line shows the current size of your file and how it's changed from the base of your PR (typically the `master` branch). With this Travis script, you'll catch code bloat regressions as they happen.\n\n# Setup\n\nI'll assume you have a GitHub repo with [Travis-CI][] enabled.\n\n## Generate a GitHub OAuth token\n\nFirst you'll need to create a GitHub OAuth token for the weigh-in script to post status messages on your behalf. To do this, go to GitHub settings → \"Personal Access Tokens\" → \"Generate a Token\":\n\n![generate new token](https://cloud.githubusercontent.com/assets/98301/10703144/173d430c-799c-11e5-8ac2-915482cacd17.png)\n\nBe sure to check the `repo:status` scope and give your token some descriptive name:\n\n![granting repo status on github](https://cloud.githubusercontent.com/assets/98301/10703161/369dfa2a-799c-11e5-9d94-6451fb8097ef.png)\n\nOnce your token is generated, copy it (you'll never be able to see it again!).\n\nNow go to Travis-CI and open up the Settings page for your repo. Add the token as an environment variable named `GITHUB_TOKEN`:\n\n![github_token set](https://cloud.githubusercontent.com/assets/98301/10703222/822cbe86-799c-11e5-8419-794a68339543.png)\n\nDon't forget to click the \"Add\" button!\n\n## Run the weigh-in script\n\nWith the token in place, you need to run the script from your `.travis.yml` file. You can either `npm install travis-weigh-in`, save a copy of the `weigh_in.py` script into your repo, add it as a git submodule, or just `curl` it into place. The script is intentionally written to have zero dependencies so, however you pull it in, it should Just Work.\n\nFor example, for a JavaScript project, your `.travis.yml` file might look like this:\n\n```\nlanguage: node_js\nnode_js:\n  - \"0.12\"\nscript: \u003e\n    npm run build \u0026\u0026\n    npm run test \u0026\u0026\n    curl -O https://raw.githubusercontent.com/danvk/travis-weigh-in/master/weigh_in.py \u0026\u0026\n    python weigh_in.py dist/script-to-track.min.js\n```\n\nEither push this commit to your repo or send it out as a pull request. The first run will only show an absolute size (i.e. no changes), but subsequent runs should show how the commit/PR changes the size of the file.\n\nIf you don't see code sizes posted, check out the logs of your Travis-CI builds for details on what went wrong.\n\n## Setup with NPM\n\nThis script is most useful for JavaScript projects, which often use NPM to pull in dependencies. If this is convenient for you, you can set up travis-weigh-in by running:\n\n    npm install --save-dev travis-weigh-in\n    \nThen your `.travis.yml` file might look like:\n\n```\nlanguage: node_js\nnode_js:\n  - \"0.12\"\nscript: \u003e\n    npm run build \u0026\u0026\n    npm run test \u0026\u0026\n    python node_modules/travis-weigh-in/weigh_in.py dist/script-to-track.min.js\n```\n\nNote that you still have to go through the process of setting `GITHUB_TOKEN` with this approach.\n\n# Notes\n\nIf you rename the file, the weigh-in script won't be able to track size changes through the rename. You'll get size change information for subsequent commits after the rename is merged onto `master`, though.\n\nIn a pull request, the \"push\" build pushes an absolute code size, while the \"pr\" build pushes a size with changes (e.g. \"+10 bytes\"). If the \"push\" build finishes first, you'll see the absolute size before you see the delta.\n\nThe code in the `master` branch can and will change. If you'd prefer not to trust me, you should either include a copy of the script directly in your own repo, use a submodule checked out at a specific commit or download a copy with a recent git SHA, e.g.\n\n```\ncurl -O https://raw.githubusercontent.com/danvk/travis-weigh-in/08700622d972fed7adeda13a49988e26a3e98387/weigh_in.py\n```\n\ngit SHAs are cryptographically secure, so you can be confident that the script won't break underneath you.\n\n[Travis-CI]: https://travis-ci.org/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Ftravis-weigh-in","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanvk%2Ftravis-weigh-in","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvk%2Ftravis-weigh-in/lists"}