Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: autometrics-dev/diff-metrics
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: autometrics-dev/diff-metrics
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: release/v1
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 10 commits
  • 10 files changed
  • 2 contributors

Commits on Jun 20, 2023

  1. chore: bump version to 1.0.0

    gagbo committed Jun 20, 2023
    Copy the full SHA
    4cd4c4d View commit details

Commits on Jun 21, 2023

  1. chore(deps-dev): bump eslint-plugin-jest from 27.2.1 to 27.2.2

    Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.2.1 to 27.2.2.
    - [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
    - [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
    - [Commits](jest-community/eslint-plugin-jest@v27.2.1...v27.2.2)
    
    ---
    updated-dependencies:
    - dependency-name: eslint-plugin-jest
      dependency-type: direct:development
      update-type: version-update:semver-patch
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    dependabot[bot] authored and gagbo committed Jun 21, 2023
    Copy the full SHA
    9683afa View commit details
  2. doc: prettify the marketplace page for the action

    - Also address feedback about the comment being too noisy
    gagbo committed Jun 21, 2023
    Copy the full SHA
    d4732e9 View commit details
  3. Update package version

    gagbo committed Jun 21, 2023
    Copy the full SHA
    43aab50 View commit details
  4. nit: rename action

    Actions can't have the same name as a user
    gagbo committed Jun 21, 2023
    Copy the full SHA
    1c0971f View commit details
  5. doc: fix readme typos

    gagbo committed Jun 21, 2023
    Copy the full SHA
    af642d2 View commit details
  6. chore: prepare release 1.0.2

    gagbo committed Jun 21, 2023
    Copy the full SHA
    fdd21bd View commit details

Commits on Jul 4, 2023

  1. Add typescript support

    gagbo committed Jul 4, 2023
    Copy the full SHA
    9104bdb View commit details

Commits on Jul 6, 2023

  1. feat: add Golang support

    Fixes #19
    gagbo committed Jul 6, 2023
    Copy the full SHA
    8c82521 View commit details
  2. chore: prepare release 1.2.0

    gagbo committed Jul 6, 2023
    Copy the full SHA
    5b3248c View commit details
Showing with 927 additions and 818 deletions.
  1. +1 −1 .gitattributes
  2. +66 −14 README.md
  3. +6 −3 action.yml
  4. BIN assets/comment_preview.png
  5. +128 −73 dist/index.js
  6. +1 −1 dist/index.js.map
  7. +702 −703 package-lock.json
  8. +9 −9 package.json
  9. +4 −10 src/comment_pr.ts
  10. +10 −4 src/main.ts
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dist/ linguist-generated=true
dist/** linguist-generated=true
80 changes: 66 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,33 @@
# Autometrics Metrics Report
# Autometrics Report

A Github action that comments on PRs to tell you how metrics are going to be affected
This GitHub action will comment on Pull Requests to tell you how metrics are
going to be affected.

<!-- Put a screen shot of the PR comment here. -->
The report tells you immediately if your new feature is well instrumented, and
shows a useful summary of the metrics that will be reported without needing to
go through the diff.

<!-- Put a language support table here. Or at least mention that it's mostly driven by am_list -->
![An example of generated report on Github](./assets/comment_preview.png)

## Inputs

- `gh-token`: a github token that gives access to
+ the PR
+ the repo
+ read/write access to comments on issues/PR
The permissions added in the
"Example Usage" section allow to use the built-in `${{ secrets.GITHUB_TOKEN }}`
directly for that.

**The built-in `${{ secrets.GITHUB_TOKEN }}` will work, you do not need to create a new one.**
To make the built-in token work, the job must be given a specific set of permissions. The permissions added in the
["Example Usage" section](#example-usage) show the minimal set of permissions needed.
- `rs-roots`: a list of project roots for rust projects, one root per line.
The values are given relative to the root of the repository, and should
point to the directory containing the `Cargo.toml` directory.
point to the directory containing the `Cargo.toml` file.
- `ts-roots`: a list of project roots for typescript projects, one root per line.
The values are given relative to the root of the repository, and should
point to the directory containing the `package.json` file.
- `go-roots`: a list of project roots for golang projects, one root per line.
The values are given relative to the root of the repository, and should
point to the directory containing the `go.mod` file.
- `retention-days`: the number of days to keep the list of functions as
[workflow
artifacts](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts#about-workflow-artifacts).
@@ -28,19 +38,32 @@ A Github action that comments on PRs to tell you how metrics are going to be aff
tell the action to download the latest version that falls within the bound.
Defaults to an empty string (`""`), which means "download the latest version,
semver-wise"

| Argument | Mandatory
:----------:|:-----------:
gh-token | yes
rs-roots | no
ts-roots | no
go-roots | no
retention-days | no
am-version | no

## Outputs

This action has no programmatic output to use in further steps. It only writes
its output as a comment to the PR.
The action does 2 things:
- it writes comments to pull request giving the monitoring impact of the Pull Request.
- it saves the data used to compute this report as workflow artifacts. Workflow artifacts
stay private to the repository that created them, but this allows for further processing
if need be.


## Example Usage

The job must only contain the diff-metrics step and the checkout one, otherwise the steps that follow
might see an older version of the repository
The job must only contain the checkout step and the diff-metrics step, the steps that follow
within the job would act on an older version of the repository.

```yaml
name: Compare Metrics
name: Metrics report

on: [pull_request]

@@ -83,6 +106,14 @@ In the case of a mono repo that would look like
├── project-c
│ ├── README.md
│ │ ...
│ └── Cargo.toml
├── project-d
│ ├── README.md
│ │ ...
│ └── go.mod
├── project-ts
│ ├── README.md
│ │ ...
│ └── package.json
└── README.md
```
@@ -95,6 +126,27 @@ with:
rust-roots: |
project-a
project-b
ts-roots: |
project-c
go-roots: |
project-d
ts-roots: |
project-ts
```
###### Language support
Look at the issues in the repository to see the advancement of language support.
All languages in the table will be eventually supported.
Language | Support
:---:|:---:
[Rust](https://github.com/autometrics-dev/autometrics-rs) | ✅
[Typescript](https://github.com/autometrics-dev/autometrics-ts) | ✅
[Go](https://github.com/autometrics-dev/autometrics-go) | ⚠️[^mid]
[Python](https://github.com/autometrics-dev/autometrics-py) | ❌
[C#](https://github.com/autometrics-dev/autometrics-cs) | ❌
[^mid]: Golang's version detects functions decorated with `//autometrics` directives, but
does not deal with `net/http` middleware wrapper yet.
9 changes: 6 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Autometrics Diff Metrics'
description: 'Check the difference in autometrics coverage between the source and the target of a Pull Request.'
author: 'autometrics-dev'
name: 'Autometrics Report'
description: 'Get a report in autometrics coverage of functions in Pull Requests.'
author: 'Autometrics-dev'
branding:
icon: 'bar-chart'
color: 'purple'
@@ -14,6 +14,9 @@ inputs:
ts-roots:
description: 'The list of typescript project roots to check. One path per line'
required: false
go-roots:
description: 'The list of golang project roots to check. One path per line'
required: false
retention-days:
description: 'The number of days to keep the artifacts for. Defaults to 0 (inherits the policy from the repository)'
required: false
Binary file added assets/comment_preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading