microsoft / PR-Metrics

A GitHub Action & Azure Pipelines task for augmenting pull request titles to let reviewers quickly determine PR size and test coverage.
https://github.com/microsoft/Omex
MIT License
58 stars 12 forks source link

XS✔ ◾ Validating PR IDs #393

Closed muiriswoulfe closed 1 year ago

muiriswoulfe commented 1 year ago

Summary

Motivation

The Pull Request ID is required for calling Azure DevOps and GitHub APIs.

For GitHub, this is coming from the variable GITHUB_REF. But the variable is only validly set when using pull_request as the build trigger according to https://docs.github.com/actions/learn-github-actions/variables.

It is beneficial as per #382 to better flag this error and provide guidance as to how to remediate the issue.

Technical

Updating the code to fail gracefully when the Pull Request ID is unavailable. The message will provide instructions as to the correct course of action to take.

Additional documentation is being added to the README to provide further assistance.

Note that, unfortunately, it is not possible to support the pull_request_target trigger as the Pull Request ID is unavailable when using this.

The update also updates all dependencies.

Resolves #382.

Testing

Test Types

Unit Test Coverage

100%

github-actions[bot] commented 1 year ago

PR Metrics

Thanks for keeping your pull request small.Thanks for adding tests. Lines
Product Code 54
Test Code 205
Subtotal 259
Ignored Code 199
Total 458

Metrics computed by PR Metrics. Add it to your Azure DevOps and GitHub PRs!