Pull Request Validation using Scratch Org

Review Stage

This pipeline demonstrates how you can build a pull request validation pipeline using scratch org. Here is a snapshot of the steps we have used to configure a pipeline. The intend of this pipeline is to validate a pull/merge request into the integration branch upon completion of a feature branch by developers.

The pipeline demonstrated below is a quite simple one, assuming there is only one package directory in your project. If you are having a mono repo with multiple package directories, the PR validation Job will feature multiple deploy tasks

This pipeline is triggered on every pull request raised against a develop/master branch depending on your git flow.

Pipeline Snapshot

The pipeline is available as part of the sample pipelines.

A Build Pipeline used for PR/Validation Stage in Classic Designer

Tasks Involved

The steps that are part of this pipeline are (in the exact order)

  1. Validate Unlocked Package ( Only necessary if you are building an unlocked package)

  2. Authenticate an Org( In this case, it is authenticating against DevHub)

  3. Create/Delete a scratch org( Action :Create)

This pipeline need to be enabled only with PR triggers, CI triggers for pipeline should be disabled. Follow this documentation to enable this PR trigger using this link

Please note this is just a sample of the minimal steps that you need to add to do a PR validation.

Edit on GitHub