A GitHub Action & Azure Pipelines task for augmenting pull request titles to let reviewers quickly determine PR size and test coverage.
Перейти к файлу
dependabot[bot] c8cf5920e4
XS✔ Bump softprops/action-gh-release from 2.0.8 to 2.0.9 (#554)
Bumps
[softprops/action-gh-release](https://github.com/softprops/action-gh-release)
from 2.0.8 to 2.0.9.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/releases">softprops/action-gh-release's
releases</a>.</em></p>
<blockquote>
<h2>v2.0.9</h2>
<!-- raw HTML omitted -->
<h2>What's Changed</h2>
<ul>
<li>maintenance release with updated dependencies</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/kbakdev"><code>@​kbakdev</code></a> made
their first contribution in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/521">softprops/action-gh-release#521</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/softprops/action-gh-release/compare/v2...v2.0.9">https://github.com/softprops/action-gh-release/compare/v2...v2.0.9</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md">softprops/action-gh-release's
changelog</a>.</em></p>
<blockquote>
<h2>2.0.9</h2>
<ul>
<li>maintenance release with updated dependencies</li>
</ul>
<h2>2.0.8</h2>
<h3>Other Changes 🔄</h3>
<ul>
<li>chore(deps): bump prettier from 2.8.0 to 3.3.3 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/480">softprops/action-gh-release#480</a></li>
<li>chore(deps): bump <code>@​types/node</code> from 20.14.9 to 20.14.11
by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>
in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/483">softprops/action-gh-release#483</a></li>
<li>chore(deps): bump <code>@​octokit/plugin-throttling</code> from
9.3.0 to 9.3.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/484">softprops/action-gh-release#484</a></li>
<li>chore(deps): bump glob from 10.4.2 to 11.0.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/477">softprops/action-gh-release#477</a></li>
<li>refactor: write jest config in ts by <a
href="https://github.com/chenrui333"><code>@​chenrui333</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/485">softprops/action-gh-release#485</a></li>
<li>chore(deps): bump <code>@​actions/github</code> from 5.1.1 to 6.0.0
by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>
in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/470">softprops/action-gh-release#470</a></li>
</ul>
<h2>2.0.7</h2>
<h3>Bug fixes 🐛</h3>
<ul>
<li>Fix missing update release body by <a
href="https://github.com/FirelightFlagboy"><code>@​FirelightFlagboy</code></a>
in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/365">softprops/action-gh-release#365</a></li>
</ul>
<h3>Other Changes 🔄</h3>
<ul>
<li>Bump <code>@​octokit/plugin-retry</code> from 4.0.3 to 7.1.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/443">softprops/action-gh-release#443</a></li>
<li>Bump typescript from 4.9.5 to 5.5.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/467">softprops/action-gh-release#467</a></li>
<li>Bump <code>@​types/node</code> from 20.14.6 to 20.14.8 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/469">softprops/action-gh-release#469</a></li>
<li>Bump <code>@​types/node</code> from 20.14.8 to 20.14.9 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/473">softprops/action-gh-release#473</a></li>
<li>Bump typescript from 5.5.2 to 5.5.3 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/472">softprops/action-gh-release#472</a></li>
<li>Bump ts-jest from 29.1.5 to 29.2.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/479">softprops/action-gh-release#479</a></li>
<li>docs: document that existing releases are updated by <a
href="https://github.com/jvanbruegge"><code>@​jvanbruegge</code></a> in
<a
href="https://redirect.github.com/softprops/action-gh-release/pull/474">softprops/action-gh-release#474</a></li>
</ul>
<h2>2.0.6</h2>
<ul>
<li>maintenance release with updated dependencies</li>
</ul>
<h2>2.0.5</h2>
<ul>
<li>Factor in file names with spaces when upserting files <a
href="https://redirect.github.com/softprops/action-gh-release/pull/446">#446</a>
via <a
href="https://github.com/MystiPanda"><code>@​MystiPanda</code></a></li>
<li>Improvements to error handling <a
href="https://redirect.github.com/softprops/action-gh-release/pull/449">#449</a>
via <a href="https://github.com/till"><code>@​till</code></a></li>
</ul>
<h2>2.0.4</h2>
<ul>
<li>Minor follow up to <a
href="https://redirect.github.com/softprops/action-gh-release/pull/417">#417</a>.
<a
href="https://redirect.github.com/softprops/action-gh-release/pull/425">#425</a></li>
</ul>
<h2>2.0.3</h2>
<ul>
<li>Declare <code>make_latest</code> as an input field in
<code>action.yml</code> <a
href="https://redirect.github.com/softprops/action-gh-release/pull/419">#419</a></li>
</ul>
<h2>2.0.2</h2>
<ul>
<li>Revisit approach to <a
href="https://redirect.github.com/softprops/action-gh-release/pull/384">#384</a>
making unresolved pattern failures opt-in <a
href="https://redirect.github.com/softprops/action-gh-release/pull/417">#417</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="e7a8f85e1c"><code>e7a8f85</code></a>
chore: release 2.0.9</li>
<li><a
href="04afa1392e"><code>04afa13</code></a>
chore(deps): bump actions/setup-node from 4.0.4 to 4.1.0 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/535">#535</a>)</li>
<li><a
href="894468a03c"><code>894468a</code></a>
chore(deps): bump actions/checkout from 4.2.1 to 4.2.2 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/534">#534</a>)</li>
<li><a
href="3bd23aa9ec"><code>3bd23aa</code></a>
chore(deps): bump <code>@​types/node</code> from 22.7.5 to 22.8.2 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/533">#533</a>)</li>
<li><a
href="21eb2f9554"><code>21eb2f9</code></a>
chore(deps): bump <code>@​types/jest</code> from 29.5.13 to 29.5.14 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/532">#532</a>)</li>
<li><a
href="cd8b57e572"><code>cd8b57e</code></a>
remove unused imports (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/521">#521</a>)</li>
<li><a
href="820a5adc43"><code>820a5ad</code></a>
chore(deps): bump actions/checkout from 4.2.0 to 4.2.1 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/522">#522</a>)</li>
<li><a
href="9d04f90cd8"><code>9d04f90</code></a>
chore(deps): bump <code>@​octokit/plugin-throttling</code> from 9.3.1 to
9.3.2 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/523">#523</a>)</li>
<li><a
href="aaf1d5f6d5"><code>aaf1d5f</code></a>
chore(deps): bump <code>@​actions/core</code> from 1.10.1 to 1.11.1 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/524">#524</a>)</li>
<li><a
href="7d33a7ecc3"><code>7d33a7e</code></a>
chore(deps): bump <code>@​types/node</code> from 22.5.5 to 22.7.5 (<a
href="https://redirect.github.com/softprops/action-gh-release/issues/525">#525</a>)</li>
<li>Additional commits viewable in <a
href="c062e08bd5...e7a8f85e1c">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=softprops/action-gh-release&package-manager=github_actions&previous-version=2.0.8&new-version=2.0.9)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-01 12:32:12 +00:00
.devcontainer XL✔ Bump github/super-linter from 6 to 7 (#535) 2024-09-01 22:44:01 +01:00
.github XS✔ Bump softprops/action-gh-release from 2.0.8 to 2.0.9 (#554) 2024-11-01 12:32:12 +00:00
.vscode XS✔ Adding Codespaces support (#302) 2022-12-01 13:01:12 +00:00
dist XS✔ [Autogenerated] Release v1.6.3 (#540) 2024-09-09 11:40:31 +01:00
docs XS✔ Fetch Depth Docs (#543) 2024-09-23 11:41:21 +01:00
src XS✔ [Autogenerated] Release v1.6.3 (#540) 2024-09-09 11:40:31 +01:00
.c8rc.json XL✔ Bump github/super-linter from 6 to 7 (#535) 2024-09-01 22:44:01 +01:00
.editorconfig XS⚠️ Repo Enhancements (#509) 2024-06-07 09:23:19 +01:00
.gitignore L✔ PR Metrics v1.4.0: Creating GitHub Action (#173) 2022-04-04 10:18:48 +01:00
.markdownlint.json Updating project layout and builds (#21) 2021-03-10 10:35:20 +00:00
.npmrc Adding skeleton code 2021-03-19 19:14:11 +00:00
LICENSE S✔ Adding support for Workload Identity Federation (#513) 2024-06-17 16:25:39 +01:00
README.md XS✔ Fetch Depth Docs (#543) 2024-09-23 11:41:21 +01:00
SECURITY.md XS✔ Bump glob and glob-promise (#231) 2022-08-04 08:50:56 +01:00
action.yml XL✔ Bump github/super-linter from 6 to 7 (#535) 2024-09-01 22:44:01 +01:00
babel.config.json XL✔ Bump github/super-linter from 6 to 7 (#535) 2024-09-01 22:44:01 +01:00
eslint.config.mjs L✔ Enhancing linting (#537) 2024-09-06 08:57:34 +01:00
package-lock.json XS✔ [Autogenerated] Release v1.6.3 (#540) 2024-09-09 11:40:31 +01:00
package.json XS✔ [Autogenerated] Release v1.6.3 (#540) 2024-09-09 11:40:31 +01:00

README.md

PR Metrics

Open in GitHub Codespaces

PR Metrics is a both a GitHub Action and Azure DevOps Pipelines task for adding size and test coverage indicators to the start of each Pull Request title.

The Azure Pipelines task can be downloaded from the Visual Studio Marketplace.

For example, a PR with the title "Adding code" could become either:

  • XS ✔️ ▪️ Adding code
  • L ⚠️ ▪️ Adding code

The former would indicate an extra small PR with sufficient test coverage, whereas the latter would indicate a large PR with insufficient test coverage.

This task helps ensure engineers keep PRs to an appropriate size with appropriate test coverage, while informing reviewers of the expected time commitment for a thorough review of the code.

The task will also add a comment to the PR with a detailed breakdown of the metrics:

Metrics for iteration 1

✔️ Thanks for keeping your pull request small.

✔️ Thanks for adding tests.

Lines
Product Code 100
Test Code 50
Subtotal 150
Ignored 5
Total 155

It will furthermore add a comment to indicate that review of specific excluded files is unnecessary.

This file doesn't require review.

If no PR description is provided, the description will be set to:

Add a description.

Inputs

You will need to set the environment variable PR_Metrics_Access_Token to a Personal Access Token (PAT) with at least Read and Write access to pull requests. If you are using a Classic PAT, it will need at least the 'repos' scope. Instructions on creating a new PAT can be found here. Alternatively, you can use the in-built GITHUB_TOKEN.

If using GITHUB_TOKEN, the following permissions are required:

permissions:
  pull-requests: write
  statuses: write

GitHub token permissions can be set for an individual job, workflow, or for Actions as a whole.

It is also recommended that you set continue-on-error: true as a failure within the action should not break your pipelines and prevent code development.

base-size

The maximum number of new lines in an extra small PR. If left blank, a default of 200 will be used.

growth-rate

The growth rate applied to the base size for calculating the size of larger PRs. If left blank, a default of 2.0 will be used. With a base size of 200 and a growth rate of 2.0, 400 new lines would constitute a medium PR while 800 new lines would constitute a large PR.

test-factor

The lines of test code expected for each line of product code. If left blank, a default of 1.0 will be used. This can be set to 0.0 in order to skip the reporting of the test code coverage.

file-matching-patterns

Globs specifying the files and folders to include. Autogenerated files should typically be excluded. Excluded files will contain a comment to inform reviewers that they are unlikely to need to review those files. If left blank, a default of

**/*
!**/package-lock.json

(all files except package-lock.json) will be used.

code-file-extensions

Extensions for files containing code, so that non-code files can be excluded. If left blank, a default set of file extensions will be used, which are listed here.

Example Usage

The default input values are expected to be appropriate for most builds. Therefore, the following YAML definition is recommended:

uses: microsoft/PR-Metrics@v1.6.3
name: PR Metrics
env:
  PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
continue-on-error: true

If you wish to modify the inputs, YAML akin the to the following can be used:

uses: microsoft/PR-Metrics@v1.6.3
name: PR Metrics
env:
  PR_METRICS_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
  base-size: 200
  growth-rate: 2.0
  test-factor: 1.0
  file-matching-patterns: |
    **/*
    !Ignore.cs    
  code-file-extensions: |
    cs
    ps1    
continue-on-error: true

pull_request must be used as the pipeline trigger to ensure that sufficient information, including the Pull Request ID, is available to PR Metrics. pull_request_target will not work as insufficient information is available when using this trigger.

Instructions on using the action within Azure Pipelines can be found here.

Git History

If your repository contains any non-linear history, it will be necessary to fetch Git history during checkout. This can be done by updating the actions/checkout step:

- uses: actions/checkout@4.1.7
  fetch-depth: 0

In many cases, fetch-depth will not be required so it is recommended not to set this unless the action explicitly requests it. It may also be possible to set this to a value greater than 0 if you only require a partial history, but it can be difficult to determine a value that will work consistently, due to the nature of Git history.

To avoid this, it is recommended to only use commit types that squash the Git history such as "squash merge" or "rebase and fast-forward".

Troubleshooting

A set of steps for troubleshooting any issues encountered can be found here.

Contributing

Instructions on contributing can be located in CONTRIBUTING.md.

The code is released under the MIT license.

PR Metrics is created by the OMEX team in Microsoft, which is part of the Office organization. Additional source code released by the OMEX team can be located at https://github.com/microsoft/Omex.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.