{"id":18793003,"url":"https://github.com/autometrics-dev/diff-metrics","last_synced_at":"2025-08-24T18:36:50.445Z","repository":{"id":174926292,"uuid":"650144046","full_name":"autometrics-dev/diff-metrics","owner":"autometrics-dev","description":"A github action that comments on PR to describe impact on metrics","archived":false,"fork":false,"pushed_at":"2024-04-08T21:51:46.000Z","size":4020,"stargazers_count":16,"open_issues_count":13,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-04T16:28:28.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/autometrics-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2023-06-06T12:40:12.000Z","updated_at":"2025-02-09T16:28:29.000Z","dependencies_parsed_at":"2024-11-07T21:25:15.285Z","dependency_job_id":"6d6867e6-12e5-41f6-93ef-89fa58517a11","html_url":"https://github.com/autometrics-dev/diff-metrics","commit_stats":null,"previous_names":["autometrics-dev/diff-metrics"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fdiff-metrics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fdiff-metrics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fdiff-metrics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/autometrics-dev%2Fdiff-metrics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/autometrics-dev","download_url":"https://codeload.github.com/autometrics-dev/diff-metrics/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248728016,"owners_count":21152140,"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-11-07T21:23:05.610Z","updated_at":"2025-04-13T14:31:44.178Z","avatar_url":"https://github.com/autometrics-dev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Autometrics Report\n\nThis GitHub action will comment on Pull Requests to tell you how metrics are\ngoing to be affected.\n\nThe report tells you immediately if your new feature is well instrumented, and\nshows a useful summary of the metrics that will be reported without needing to\ngo through the diff.\n\n![An example of generated report on Github](./assets/comment_preview.png)\n\n## Inputs\n\n- `gh-token`: a github token that gives access to\n\n  - the PR\n  - the repo\n  - read/write access to comments on issues/PR\n\n  **The built-in `${{ secrets.GITHUB_TOKEN }}` will work, you do not need to create a new one.**\n  To make the built-in token work, the job must be given a specific set of permissions. The permissions added in the\n  [\"Example Usage\" section](#example-usage) show the minimal set of permissions needed.\n\n- `rs-roots`: a list of project roots for rust projects, one root per line.\n  The values are given relative to the root of the repository, and should\n  point to the directory containing the `Cargo.toml` file.\n- `ts-roots`: a list of project roots for typescript projects, one root per line.\n  The values are given relative to the root of the repository, and should\n  point to the directory containing the `package.json` file.\n- `go-roots`: a list of project roots for golang projects, one root per line.\n  The values are given relative to the root of the repository, and should\n  point to the directory containing the `go.mod` file.\n- `py-roots`: a list of project roots for python projects, one root per line.\n  The values are given relative to the root of the repository, and should\n  point to the directory containing the actual module source code. If you have a monorepo,\n  you need to specify the root of each submodule.\n- `retention-days`: the number of days to keep the list of functions as\n  [workflow\n  artifacts](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#about-workflow-artifacts).\n  By default it will use the same retention settings as the settings in the\n  repository (by setting `retention-days` to 0)\n- `am-version`: a string that allows to choose the version of `am_list` to\n  download/use. You can skip the patch (e.g. `0.2`) or the minor (e.g. `0`) to\n  tell the action to download the latest version that falls within the bound.\n  Defaults to an empty string (`\"\"`), which means \"download the latest version,\n  semver-wise\"\n\n|    Argument    | Mandatory |\n| :------------: | :-------: |\n|    gh-token    |    yes    |\n|    rs-roots    |    no     |\n|    ts-roots    |    no     |\n|    go-roots    |    no     |\n|    py-roots    |    no     |\n| retention-days |    no     |\n|   am-version   |    no     |\n\n## Outputs\n\nThe action does 2 things:\n\n- it writes comments to pull request giving the monitoring impact of the Pull Request.\n- it saves the data used to compute this report as workflow artifacts. Workflow artifacts\n  stay private to the repository that created them, but this allows for further processing\n  if need be.\n\n## Example Usage\n\nThe job must only contain the checkout step and the diff-metrics step, the steps that follow\nwithin the job would act on an older version of the repository.\n\n```yaml\nname: Metrics report\n\non: [pull_request]\n\njobs:\n  build:\n    # The task only runs on linux x64 machines.\n    runs-on: ubuntu-latest\n\n    # Permissions are necessary to be able to edit and write comments on the PR\n    permissions:\n      issues: write\n      pull-requests: write\n      repository-projects: read\n      contents: read\n\n    steps:\n      - uses: actions/checkout@v3\n      - uses: autometrics-dev/diff-metrics@v1\n        with:\n          gh-token: ${{ secrets.GITHUB_TOKEN }}\n          rs-roots: |\n            .\n```\n\n### Mono repo example\n\nIn the case of a mono repo that would look like\n\n```\n.\n├── project-a\n│  ├── README.md\n│  │ ...\n│  └── Cargo.toml\n├── project-b\n│  ├── README.md\n│  │ ...\n│  └── Cargo.toml\n├── project-c\n│  ├── README.md\n│  │ ...\n│  └── Cargo.toml\n├── project-d\n│  ├── README.md\n│  │ ...\n│  └── go.mod\n├── project-ts\n│  ├── README.md\n│  │ ...\n│  └── package.json\n└── README.md\n```\n\nThe step using diff-metrics would look like this:\n\n```yaml\nuses: autometrics-dev/diff-metrics@v1\nwith:\n  gh-token: ${{ secrets.GITHUB_TOKEN }}\n  rs-roots: |\n    project-a\n    project-b\n    project-c\n  go-roots: |\n    project-d\n  ts-roots: |\n    project-ts\n```\n\n###### Language support\n\nLook at the issues in the repository to see the advancement of language support.\nAll languages in the table will be eventually supported.\n\n|                            Language                             | Support  |\n| :-------------------------------------------------------------: | :------: |\n|    [Rust](https://github.com/autometrics-dev/autometrics-rs)    |    ✅    |\n| [Typescript](https://github.com/autometrics-dev/autometrics-ts) |    ✅    |\n|     [Go](https://github.com/autometrics-dev/autometrics-go)     | ⚠️[^mid] |\n|   [Python](https://github.com/autometrics-dev/autometrics-py)   |    ✅    |\n|     [C#](https://github.com/autometrics-dev/autometrics-cs)     |    ❌    |\n\n[^mid]:\n    Golang's version detects functions decorated with `//autometrics` directives, but\n    does not deal with `net/http` middleware wrapper yet.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautometrics-dev%2Fdiff-metrics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fautometrics-dev%2Fdiff-metrics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fautometrics-dev%2Fdiff-metrics/lists"}