'How to require new NPM version in PR with Azure DevOps

I'm not sure how to go about this, but here's the desired behavior:

  1. Individual Contributor (IC) submits Pull Request (PR) with bugfix, minor changes, new feature, etc.
  2. Azure DevOps (ADO) compares version within package.json from last deployment/release.
  3. If incoming version > last deployed version, then PR passes check and can be approved for merge. If not, PR is automatically rejected with message to IC to update version and resubmit.

For context, I already have a build & release pipeline that requires code review and checks for an optional linked work item, so I would prefer to add this into that process.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source